Preload conversation open data

Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
Fedor Indutny 2024-08-21 18:48:29 -07:00 committed by GitHub
parent 6ea47d9c6b
commit 7db33a6708
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 332 additions and 89 deletions

View file

@ -2,6 +2,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
import React, { useState } from 'react';
import { noop } from 'lodash';
import type {
ConversationType,
ShowConversationType,
@ -45,6 +46,7 @@ export function AnnouncementsOnlyGroupBanner({
onClick={() => {
showConversation({ conversationId: admin.id });
}}
onMouseDown={noop}
theme={theme}
/>
))}

View file

@ -68,6 +68,7 @@ function Wrapper({
shouldRecomputeRowHeights={false}
i18n={i18n}
blockConversation={action('blockConversation')}
onPreloadConversation={action('onPreloadConversation')}
onSelectConversation={action('onSelectConversation')}
onOutgoingAudioCallInConversation={action(
'onOutgoingAudioCallInConversation'

View file

@ -197,6 +197,7 @@ export type PropsType = {
conversationId: string,
disabledReason: undefined | ContactCheckboxDisabledReason
) => void;
onPreloadConversation: (conversationId: string, messageId?: string) => void;
onSelectConversation: (conversationId: string, messageId?: string) => void;
onOutgoingAudioCallInConversation: (conversationId: string) => void;
onOutgoingVideoCallInConversation: (conversationId: string) => void;
@ -220,6 +221,7 @@ export function ConversationList({
blockConversation,
onClickArchiveButton,
onClickContactCheckbox,
onPreloadConversation,
onSelectConversation,
onOutgoingAudioCallInConversation,
onOutgoingVideoCallInConversation,
@ -411,6 +413,7 @@ export function ConversationList({
})}
key={key}
badge={getPreferredBadge(badges)}
onMouseDown={onPreloadConversation}
onClick={onSelectConversation}
i18n={i18n}
theme={theme}
@ -527,6 +530,7 @@ export function ConversationList({
onClickContactCheckbox,
onOutgoingAudioCallInConversation,
onOutgoingVideoCallInConversation,
onPreloadConversation,
onSelectConversation,
removeConversation,
renderMessageSearchResult,

View file

@ -400,6 +400,7 @@ export function ForwardMessagesModal({
showConversation={shouldNeverBeCalled}
showUserNotFoundModal={shouldNeverBeCalled}
setIsFetchingUUID={shouldNeverBeCalled}
onPreloadConversation={shouldNeverBeCalled}
onSelectConversation={shouldNeverBeCalled}
blockConversation={shouldNeverBeCalled}
removeConversation={shouldNeverBeCalled}

View file

@ -172,6 +172,7 @@ const useProps = (overrideProps: OverridePropsType = {}): PropsType => {
makeFakeLookupConversationWithoutServiceId(),
showUserNotFoundModal: action('showUserNotFoundModal'),
setIsFetchingUUID,
preloadConversation: action('preloadConversation'),
showConversation: action('showConversation'),
blockConversation: action('blockConversation'),
onOutgoingAudioCallInConversation: action(

View file

@ -139,6 +139,7 @@ export type PropsType = {
showFindByUsername: () => void;
showFindByPhoneNumber: () => void;
showConversation: ShowConversationType;
preloadConversation: (conversationId: string) => void;
showInbox: () => void;
startComposing: () => void;
startSearch: () => unknown;
@ -205,6 +206,7 @@ export function LeftPane({
openUsernameReservationModal,
preferredWidthFromStorage,
preloadConversation,
removeConversation,
renderCaptchaDialog,
renderCrashReportDialog,
@ -776,6 +778,7 @@ export function LeftPane({
}
showConversation={showConversation}
blockConversation={blockConversation}
onPreloadConversation={preloadConversation}
onSelectConversation={onSelectConversation}
onOutgoingAudioCallInConversation={
onOutgoingAudioCallInConversation

View file

@ -1220,6 +1220,7 @@ export function EditDistributionListModal({
onClickContactCheckbox={(conversationId: string) => {
toggleSelectedConversation(conversationId);
}}
onPreloadConversation={shouldNeverBeCalled}
onSelectConversation={shouldNeverBeCalled}
blockConversation={shouldNeverBeCalled}
removeConversation={shouldNeverBeCalled}

View file

@ -50,6 +50,7 @@ type PropsType = {
messageText?: ReactNode;
messageTextIsAlwaysFullSize?: boolean;
onClick?: () => void;
onMouseDown?: () => void;
shouldShowSpinner?: boolean;
unreadCount?: number;
unreadMentionsCount?: number;
@ -100,6 +101,7 @@ export const BaseConversationListItem: FunctionComponent<PropsType> =
messageText,
messageTextIsAlwaysFullSize,
onClick,
onMouseDown,
phoneNumber,
profileName,
sharedGroupNames,
@ -289,6 +291,7 @@ export const BaseConversationListItem: FunctionComponent<PropsType> =
data-testid={testId}
disabled={disabled}
onClick={onClick}
onMouseDown={onMouseDown}
type="button"
>
{contents}

View file

@ -74,6 +74,7 @@ type PropsHousekeeping = {
buttonAriaLabel?: string;
i18n: LocalizerType;
onClick: (id: string) => void;
onMouseDown: (id: string) => void;
theme: ThemeType;
};
@ -98,6 +99,7 @@ export const ConversationListItem: FunctionComponent<Props> = React.memo(
markedUnread,
muteExpiresAt,
onClick,
onMouseDown,
phoneNumber,
profileName,
removalStage,
@ -202,6 +204,10 @@ export const ConversationListItem: FunctionComponent<Props> = React.memo(
}
const onClickItem = useCallback(() => onClick(id), [onClick, id]);
const onMouseDownItem = useCallback(
() => onMouseDown(id),
[onMouseDown, id]
);
return (
<BaseConversationListItem
@ -223,6 +229,7 @@ export const ConversationListItem: FunctionComponent<Props> = React.memo(
messageText={messageText}
messageTextIsAlwaysFullSize
onClick={onClickItem}
onMouseDown={onMouseDownItem}
phoneNumber={phoneNumber}
profileName={profileName}
sharedGroupNames={sharedGroupNames}