2022-02-14 17:57:11 +00:00
|
|
|
// Copyright 2021-2022 Signal Messenger, LLC
|
2021-04-27 22:35:35 +00:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2021-10-26 19:15:33 +00:00
|
|
|
import type { FunctionComponent } from 'react';
|
2021-04-27 22:35:35 +00:00
|
|
|
import React, {
|
|
|
|
useCallback,
|
|
|
|
useEffect,
|
|
|
|
useMemo,
|
|
|
|
useRef,
|
|
|
|
useState,
|
|
|
|
} from 'react';
|
2021-10-26 19:15:33 +00:00
|
|
|
import type { MeasuredComponentProps } from 'react-measure';
|
|
|
|
import Measure from 'react-measure';
|
2021-04-27 22:35:35 +00:00
|
|
|
import { noop } from 'lodash';
|
2021-10-14 16:52:42 +00:00
|
|
|
import { animated } from '@react-spring/web';
|
2021-04-27 22:35:35 +00:00
|
|
|
|
|
|
|
import classNames from 'classnames';
|
|
|
|
import { AttachmentList } from './conversation/AttachmentList';
|
2021-12-03 01:05:32 +00:00
|
|
|
import type { AttachmentType } from '../types/Attachment';
|
2021-04-27 22:35:35 +00:00
|
|
|
import { Button } from './Button';
|
2021-10-26 19:15:33 +00:00
|
|
|
import type { InputApi } from './CompositionInput';
|
|
|
|
import { CompositionInput } from './CompositionInput';
|
2021-07-20 20:18:35 +00:00
|
|
|
import { ConfirmationDialog } from './ConfirmationDialog';
|
2021-04-27 22:35:35 +00:00
|
|
|
import { ContactCheckboxDisabledReason } from './conversationList/ContactCheckbox';
|
2021-10-26 19:15:33 +00:00
|
|
|
import type { Row } from './ConversationList';
|
|
|
|
import { ConversationList, RowType } from './ConversationList';
|
|
|
|
import type { ConversationType } from '../state/ducks/conversations';
|
2021-11-17 18:38:52 +00:00
|
|
|
import type { PreferredBadgeSelectorType } from '../state/selectors/badges';
|
2021-10-26 19:15:33 +00:00
|
|
|
import type { Props as EmojiButtonProps } from './emoji/EmojiButton';
|
|
|
|
import { EmojiButton } from './emoji/EmojiButton';
|
|
|
|
import type { EmojiPickDataType } from './emoji/EmojiPicker';
|
|
|
|
import type { LinkPreviewType } from '../types/message/LinkPreviews';
|
2021-11-02 23:01:13 +00:00
|
|
|
import type { BodyRangeType, LocalizerType, ThemeType } from '../types/Util';
|
2021-04-27 22:35:35 +00:00
|
|
|
import { ModalHost } from './ModalHost';
|
2021-05-11 00:50:43 +00:00
|
|
|
import { SearchInput } from './SearchInput';
|
2021-04-27 22:35:35 +00:00
|
|
|
import { StagedLinkPreview } from './conversation/StagedLinkPreview';
|
2021-04-28 20:44:48 +00:00
|
|
|
import { filterAndSortConversationsByRecent } from '../util/filterAndSortConversations';
|
2021-09-29 20:59:37 +00:00
|
|
|
import { useAnimated } from '../hooks/useAnimated';
|
2022-07-21 00:07:09 +00:00
|
|
|
import {
|
|
|
|
shouldNeverBeCalled,
|
|
|
|
asyncShouldNeverBeCalled,
|
|
|
|
} from '../util/shouldNeverBeCalled';
|
2021-04-27 22:35:35 +00:00
|
|
|
|
|
|
|
export type DataPropsType = {
|
2021-12-03 01:05:32 +00:00
|
|
|
attachments?: Array<AttachmentType>;
|
2021-04-27 22:35:35 +00:00
|
|
|
candidateConversations: ReadonlyArray<ConversationType>;
|
|
|
|
doForwardMessage: (
|
|
|
|
selectedContacts: Array<string>,
|
|
|
|
messageBody?: string,
|
2021-12-03 01:05:32 +00:00
|
|
|
attachments?: Array<AttachmentType>,
|
2021-04-27 22:35:35 +00:00
|
|
|
linkPreview?: LinkPreviewType
|
|
|
|
) => void;
|
2021-11-17 18:38:52 +00:00
|
|
|
getPreferredBadge: PreferredBadgeSelectorType;
|
2022-04-11 20:57:44 +00:00
|
|
|
hasContact: boolean;
|
2021-04-27 22:35:35 +00:00
|
|
|
i18n: LocalizerType;
|
|
|
|
isSticker: boolean;
|
|
|
|
linkPreview?: LinkPreviewType;
|
|
|
|
messageBody?: string;
|
|
|
|
onClose: () => void;
|
|
|
|
onEditorStateChange: (
|
|
|
|
messageText: string,
|
|
|
|
bodyRanges: Array<BodyRangeType>,
|
|
|
|
caretLocation?: number
|
|
|
|
) => unknown;
|
|
|
|
onTextTooLong: () => void;
|
2021-11-02 23:01:13 +00:00
|
|
|
theme: ThemeType;
|
2022-04-05 00:38:22 +00:00
|
|
|
regionCode: string | undefined;
|
2021-04-27 22:35:35 +00:00
|
|
|
} & Pick<EmojiButtonProps, 'recentEmojis' | 'skinTone'>;
|
|
|
|
|
|
|
|
type ActionPropsType = Pick<
|
|
|
|
EmojiButtonProps,
|
|
|
|
'onPickEmoji' | 'onSetSkinTone'
|
|
|
|
> & {
|
|
|
|
removeLinkPreview: () => void;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type PropsType = DataPropsType & ActionPropsType;
|
|
|
|
|
|
|
|
const MAX_FORWARD = 5;
|
|
|
|
|
|
|
|
export const ForwardMessageModal: FunctionComponent<PropsType> = ({
|
|
|
|
attachments,
|
|
|
|
candidateConversations,
|
|
|
|
doForwardMessage,
|
2021-11-17 18:38:52 +00:00
|
|
|
getPreferredBadge,
|
2022-04-11 20:57:44 +00:00
|
|
|
hasContact,
|
2021-04-27 22:35:35 +00:00
|
|
|
i18n,
|
|
|
|
isSticker,
|
|
|
|
linkPreview,
|
|
|
|
messageBody,
|
|
|
|
onClose,
|
|
|
|
onEditorStateChange,
|
|
|
|
onPickEmoji,
|
|
|
|
onSetSkinTone,
|
|
|
|
onTextTooLong,
|
|
|
|
recentEmojis,
|
|
|
|
removeLinkPreview,
|
|
|
|
skinTone,
|
2021-11-02 23:01:13 +00:00
|
|
|
theme,
|
2022-04-05 00:38:22 +00:00
|
|
|
regionCode,
|
2021-04-27 22:35:35 +00:00
|
|
|
}) => {
|
|
|
|
const inputRef = useRef<null | HTMLInputElement>(null);
|
|
|
|
const inputApiRef = React.useRef<InputApi | undefined>();
|
|
|
|
const [selectedContacts, setSelectedContacts] = useState<
|
|
|
|
Array<ConversationType>
|
|
|
|
>([]);
|
|
|
|
const [searchTerm, setSearchTerm] = useState('');
|
2021-04-28 20:44:48 +00:00
|
|
|
const [filteredConversations, setFilteredConversations] = useState(
|
2022-04-05 00:38:22 +00:00
|
|
|
filterAndSortConversationsByRecent(candidateConversations, '', regionCode)
|
2021-04-27 22:35:35 +00:00
|
|
|
);
|
2021-11-15 21:54:33 +00:00
|
|
|
const [attachmentsToForward, setAttachmentsToForward] = useState<
|
2021-12-03 01:05:32 +00:00
|
|
|
Array<AttachmentType>
|
2021-11-15 21:54:33 +00:00
|
|
|
>(attachments || []);
|
2021-04-27 22:35:35 +00:00
|
|
|
const [isEditingMessage, setIsEditingMessage] = useState(false);
|
|
|
|
const [messageBodyText, setMessageBodyText] = useState(messageBody || '');
|
2021-07-20 20:18:35 +00:00
|
|
|
const [cannotMessage, setCannotMessage] = useState(false);
|
2021-04-27 22:35:35 +00:00
|
|
|
|
2022-04-11 20:57:44 +00:00
|
|
|
const isMessageEditable = !isSticker && !hasContact;
|
2021-04-27 22:35:35 +00:00
|
|
|
|
|
|
|
const hasSelectedMaximumNumberOfContacts =
|
|
|
|
selectedContacts.length >= MAX_FORWARD;
|
|
|
|
|
|
|
|
const selectedConversationIdsSet: Set<string> = useMemo(
|
|
|
|
() => new Set(selectedContacts.map(contact => contact.id)),
|
|
|
|
[selectedContacts]
|
|
|
|
);
|
|
|
|
|
|
|
|
const focusTextEditInput = React.useCallback(() => {
|
|
|
|
if (inputApiRef.current) {
|
|
|
|
inputApiRef.current.focus();
|
|
|
|
}
|
|
|
|
}, [inputApiRef]);
|
|
|
|
|
|
|
|
const insertEmoji = React.useCallback(
|
|
|
|
(e: EmojiPickDataType) => {
|
|
|
|
if (inputApiRef.current) {
|
|
|
|
inputApiRef.current.insertEmoji(e);
|
|
|
|
onPickEmoji(e);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
[inputApiRef, onPickEmoji]
|
|
|
|
);
|
|
|
|
|
2021-04-28 22:23:04 +00:00
|
|
|
const hasContactsSelected = Boolean(selectedContacts.length);
|
|
|
|
|
|
|
|
const canForwardMessage =
|
|
|
|
hasContactsSelected &&
|
|
|
|
(Boolean(messageBodyText) ||
|
|
|
|
isSticker ||
|
2022-04-11 20:57:44 +00:00
|
|
|
hasContact ||
|
2021-04-28 22:23:04 +00:00
|
|
|
(attachmentsToForward && attachmentsToForward.length));
|
|
|
|
|
2021-04-27 22:35:35 +00:00
|
|
|
const forwardMessage = React.useCallback(() => {
|
2021-04-28 22:23:04 +00:00
|
|
|
if (!canForwardMessage) {
|
2021-04-27 22:35:35 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
doForwardMessage(
|
|
|
|
selectedContacts.map(contact => contact.id),
|
|
|
|
messageBodyText,
|
|
|
|
attachmentsToForward,
|
|
|
|
linkPreview
|
|
|
|
);
|
|
|
|
}, [
|
|
|
|
attachmentsToForward,
|
2021-04-28 22:23:04 +00:00
|
|
|
canForwardMessage,
|
2021-04-27 22:35:35 +00:00
|
|
|
doForwardMessage,
|
|
|
|
linkPreview,
|
|
|
|
messageBodyText,
|
|
|
|
selectedContacts,
|
|
|
|
]);
|
|
|
|
|
|
|
|
const normalizedSearchTerm = searchTerm.trim();
|
|
|
|
useEffect(() => {
|
|
|
|
const timeout = setTimeout(() => {
|
2021-04-28 20:44:48 +00:00
|
|
|
setFilteredConversations(
|
|
|
|
filterAndSortConversationsByRecent(
|
|
|
|
candidateConversations,
|
2022-04-05 00:38:22 +00:00
|
|
|
normalizedSearchTerm,
|
|
|
|
regionCode
|
2021-04-28 20:44:48 +00:00
|
|
|
)
|
2021-04-27 22:35:35 +00:00
|
|
|
);
|
|
|
|
}, 200);
|
|
|
|
return () => {
|
|
|
|
clearTimeout(timeout);
|
|
|
|
};
|
2022-04-05 00:38:22 +00:00
|
|
|
}, [
|
|
|
|
candidateConversations,
|
|
|
|
normalizedSearchTerm,
|
|
|
|
setFilteredConversations,
|
|
|
|
regionCode,
|
|
|
|
]);
|
2021-04-27 22:35:35 +00:00
|
|
|
|
|
|
|
const contactLookup = useMemo(() => {
|
|
|
|
const map = new Map();
|
|
|
|
candidateConversations.forEach(contact => {
|
|
|
|
map.set(contact.id, contact);
|
|
|
|
});
|
|
|
|
return map;
|
|
|
|
}, [candidateConversations]);
|
|
|
|
|
2021-04-28 20:44:48 +00:00
|
|
|
const toggleSelectedConversation = useCallback(
|
2021-11-30 11:25:24 +00:00
|
|
|
(conversationId: string) => {
|
2021-04-27 22:35:35 +00:00
|
|
|
let removeContact = false;
|
|
|
|
const nextSelectedContacts = selectedContacts.filter(contact => {
|
2021-11-30 11:25:24 +00:00
|
|
|
if (contact.id === conversationId) {
|
2021-04-27 22:35:35 +00:00
|
|
|
removeContact = true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
if (removeContact) {
|
|
|
|
setSelectedContacts(nextSelectedContacts);
|
|
|
|
return;
|
|
|
|
}
|
2021-11-30 11:25:24 +00:00
|
|
|
const selectedContact = contactLookup.get(conversationId);
|
2021-04-27 22:35:35 +00:00
|
|
|
if (selectedContact) {
|
2021-07-20 20:18:35 +00:00
|
|
|
if (selectedContact.announcementsOnly && !selectedContact.areWeAdmin) {
|
|
|
|
setCannotMessage(true);
|
|
|
|
} else {
|
|
|
|
setSelectedContacts([...nextSelectedContacts, selectedContact]);
|
|
|
|
}
|
2021-04-27 22:35:35 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
[contactLookup, selectedContacts, setSelectedContacts]
|
|
|
|
);
|
|
|
|
|
2021-10-14 16:52:42 +00:00
|
|
|
const { close, modalStyles, overlayStyles } = useAnimated(onClose, {
|
|
|
|
getFrom: () => ({ opacity: 0, transform: 'translateY(48px)' }),
|
|
|
|
getTo: isOpen =>
|
|
|
|
isOpen
|
|
|
|
? { opacity: 1, transform: 'translateY(0px)' }
|
|
|
|
: {
|
|
|
|
opacity: 0,
|
|
|
|
transform: 'translateY(48px)',
|
|
|
|
},
|
|
|
|
});
|
2021-09-29 20:59:37 +00:00
|
|
|
|
2021-04-28 20:44:48 +00:00
|
|
|
const handleBackOrClose = useCallback(() => {
|
|
|
|
if (isEditingMessage) {
|
|
|
|
setIsEditingMessage(false);
|
|
|
|
} else {
|
2021-09-29 20:59:37 +00:00
|
|
|
close();
|
2021-04-28 20:44:48 +00:00
|
|
|
}
|
2021-09-29 20:59:37 +00:00
|
|
|
}, [isEditingMessage, close, setIsEditingMessage]);
|
2021-04-28 20:44:48 +00:00
|
|
|
|
|
|
|
const rowCount = filteredConversations.length;
|
2021-04-27 22:35:35 +00:00
|
|
|
const getRow = (index: number): undefined | Row => {
|
2021-04-28 20:44:48 +00:00
|
|
|
const contact = filteredConversations[index];
|
2021-04-27 22:35:35 +00:00
|
|
|
if (!contact) {
|
|
|
|
return undefined;
|
|
|
|
}
|
|
|
|
|
|
|
|
const isSelected = selectedConversationIdsSet.has(contact.id);
|
|
|
|
|
|
|
|
let disabledReason: undefined | ContactCheckboxDisabledReason;
|
|
|
|
if (hasSelectedMaximumNumberOfContacts && !isSelected) {
|
|
|
|
disabledReason = ContactCheckboxDisabledReason.MaximumContactsSelected;
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
type: RowType.ContactCheckbox,
|
|
|
|
contact,
|
|
|
|
isChecked: isSelected,
|
|
|
|
disabledReason,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-04-28 20:44:48 +00:00
|
|
|
useEffect(() => {
|
|
|
|
const timeout = setTimeout(() => {
|
|
|
|
inputRef.current?.focus();
|
|
|
|
}, 100);
|
|
|
|
|
|
|
|
return () => {
|
|
|
|
clearTimeout(timeout);
|
|
|
|
};
|
|
|
|
}, []);
|
|
|
|
|
2021-04-27 22:35:35 +00:00
|
|
|
return (
|
2021-07-20 20:18:35 +00:00
|
|
|
<>
|
|
|
|
{cannotMessage && (
|
|
|
|
<ConfirmationDialog
|
|
|
|
cancelText={i18n('Confirmation--confirm')}
|
|
|
|
i18n={i18n}
|
|
|
|
onClose={() => setCannotMessage(false)}
|
2021-04-27 22:35:35 +00:00
|
|
|
>
|
2021-07-20 20:18:35 +00:00
|
|
|
{i18n('GroupV2--cannot-send')}
|
|
|
|
</ConfirmationDialog>
|
|
|
|
)}
|
2021-10-14 16:52:42 +00:00
|
|
|
<ModalHost
|
|
|
|
onEscape={handleBackOrClose}
|
|
|
|
onClose={close}
|
|
|
|
overlayStyles={overlayStyles}
|
|
|
|
>
|
|
|
|
<animated.div
|
|
|
|
className="module-ForwardMessageModal"
|
|
|
|
style={modalStyles}
|
|
|
|
>
|
|
|
|
<div
|
|
|
|
className={classNames('module-ForwardMessageModal__header', {
|
|
|
|
'module-ForwardMessageModal__header--edit': isEditingMessage,
|
|
|
|
})}
|
|
|
|
>
|
2021-07-20 20:18:35 +00:00
|
|
|
{isEditingMessage ? (
|
2021-10-14 16:52:42 +00:00
|
|
|
<button
|
|
|
|
aria-label={i18n('back')}
|
|
|
|
className="module-ForwardMessageModal__header--back"
|
|
|
|
onClick={() => setIsEditingMessage(false)}
|
|
|
|
type="button"
|
|
|
|
>
|
|
|
|
|
|
|
|
</button>
|
|
|
|
) : (
|
|
|
|
<button
|
|
|
|
aria-label={i18n('close')}
|
|
|
|
className="module-ForwardMessageModal__header--close"
|
|
|
|
onClick={close}
|
|
|
|
type="button"
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
<h1>{i18n('forwardMessage')}</h1>
|
|
|
|
</div>
|
|
|
|
{isEditingMessage ? (
|
|
|
|
<div className="module-ForwardMessageModal__main-body">
|
|
|
|
{linkPreview ? (
|
|
|
|
<div className="module-ForwardMessageModal--link-preview">
|
|
|
|
<StagedLinkPreview
|
2022-06-17 00:48:57 +00:00
|
|
|
date={linkPreview.date}
|
2021-10-14 16:52:42 +00:00
|
|
|
description={linkPreview.description || ''}
|
|
|
|
domain={linkPreview.url}
|
2021-07-20 20:18:35 +00:00
|
|
|
i18n={i18n}
|
2021-10-14 16:52:42 +00:00
|
|
|
image={linkPreview.image}
|
|
|
|
onClose={() => removeLinkPreview()}
|
|
|
|
title={linkPreview.title}
|
2022-06-17 00:48:57 +00:00
|
|
|
url={linkPreview.url}
|
2021-07-20 20:18:35 +00:00
|
|
|
/>
|
2021-10-14 16:52:42 +00:00
|
|
|
</div>
|
|
|
|
) : null}
|
|
|
|
{attachmentsToForward && attachmentsToForward.length ? (
|
|
|
|
<AttachmentList
|
|
|
|
attachments={attachmentsToForward}
|
|
|
|
i18n={i18n}
|
2021-12-03 01:05:32 +00:00
|
|
|
onCloseAttachment={(attachment: AttachmentType) => {
|
2021-10-14 16:52:42 +00:00
|
|
|
const newAttachments = attachmentsToForward.filter(
|
|
|
|
currentAttachment => currentAttachment !== attachment
|
|
|
|
);
|
|
|
|
setAttachmentsToForward(newAttachments);
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
) : null}
|
|
|
|
<div className="module-ForwardMessageModal__text-edit-area">
|
|
|
|
<CompositionInput
|
|
|
|
clearQuotedMessage={shouldNeverBeCalled}
|
|
|
|
draftText={messageBodyText}
|
2021-11-17 18:38:52 +00:00
|
|
|
getPreferredBadge={getPreferredBadge}
|
2021-10-14 16:52:42 +00:00
|
|
|
getQuotedMessage={noop}
|
|
|
|
i18n={i18n}
|
|
|
|
inputApi={inputApiRef}
|
|
|
|
large
|
|
|
|
moduleClassName="module-ForwardMessageModal__input"
|
|
|
|
onEditorStateChange={(
|
|
|
|
messageText,
|
|
|
|
bodyRanges,
|
|
|
|
caretLocation
|
|
|
|
) => {
|
|
|
|
setMessageBodyText(messageText);
|
|
|
|
onEditorStateChange(messageText, bodyRanges, caretLocation);
|
|
|
|
}}
|
|
|
|
onPickEmoji={onPickEmoji}
|
|
|
|
onSubmit={forwardMessage}
|
|
|
|
onTextTooLong={onTextTooLong}
|
2021-11-17 18:38:52 +00:00
|
|
|
theme={theme}
|
2021-10-14 16:52:42 +00:00
|
|
|
/>
|
|
|
|
<div className="module-ForwardMessageModal__emoji">
|
|
|
|
<EmojiButton
|
2021-07-20 20:18:35 +00:00
|
|
|
i18n={i18n}
|
2021-10-14 16:52:42 +00:00
|
|
|
onClose={focusTextEditInput}
|
|
|
|
onPickEmoji={insertEmoji}
|
|
|
|
onSetSkinTone={onSetSkinTone}
|
|
|
|
recentEmojis={recentEmojis}
|
|
|
|
skinTone={skinTone}
|
2021-07-20 20:18:35 +00:00
|
|
|
/>
|
|
|
|
</div>
|
2021-04-27 22:35:35 +00:00
|
|
|
</div>
|
2021-10-14 16:52:42 +00:00
|
|
|
</div>
|
|
|
|
) : (
|
|
|
|
<div className="module-ForwardMessageModal__main-body">
|
|
|
|
<SearchInput
|
|
|
|
disabled={candidateConversations.length === 0}
|
2022-02-14 17:57:11 +00:00
|
|
|
i18n={i18n}
|
2021-10-14 16:52:42 +00:00
|
|
|
placeholder={i18n('contactSearchPlaceholder')}
|
|
|
|
onChange={event => {
|
|
|
|
setSearchTerm(event.target.value);
|
|
|
|
}}
|
|
|
|
ref={inputRef}
|
|
|
|
value={searchTerm}
|
|
|
|
/>
|
|
|
|
{candidateConversations.length ? (
|
|
|
|
<Measure bounds>
|
2022-06-03 21:07:51 +00:00
|
|
|
{({ contentRect, measureRef }: MeasuredComponentProps) => (
|
|
|
|
<div
|
|
|
|
className="module-ForwardMessageModal__list-wrapper"
|
|
|
|
ref={measureRef}
|
|
|
|
>
|
|
|
|
<ConversationList
|
|
|
|
dimensions={contentRect.bounds}
|
|
|
|
getPreferredBadge={getPreferredBadge}
|
|
|
|
getRow={getRow}
|
|
|
|
i18n={i18n}
|
|
|
|
onClickArchiveButton={shouldNeverBeCalled}
|
|
|
|
onClickContactCheckbox={(
|
|
|
|
conversationId: string,
|
|
|
|
disabledReason:
|
|
|
|
| undefined
|
|
|
|
| ContactCheckboxDisabledReason
|
|
|
|
) => {
|
|
|
|
if (
|
|
|
|
disabledReason !==
|
|
|
|
ContactCheckboxDisabledReason.MaximumContactsSelected
|
|
|
|
) {
|
|
|
|
toggleSelectedConversation(conversationId);
|
2022-04-05 00:38:22 +00:00
|
|
|
}
|
2022-06-03 21:07:51 +00:00
|
|
|
}}
|
|
|
|
lookupConversationWithoutUuid={asyncShouldNeverBeCalled}
|
|
|
|
showConversation={shouldNeverBeCalled}
|
|
|
|
showUserNotFoundModal={shouldNeverBeCalled}
|
|
|
|
setIsFetchingUUID={shouldNeverBeCalled}
|
|
|
|
onSelectConversation={shouldNeverBeCalled}
|
|
|
|
renderMessageSearchResult={() => {
|
|
|
|
shouldNeverBeCalled();
|
|
|
|
return <div />;
|
|
|
|
}}
|
|
|
|
rowCount={rowCount}
|
|
|
|
shouldRecomputeRowHeights={false}
|
|
|
|
showChooseGroupMembers={shouldNeverBeCalled}
|
|
|
|
theme={theme}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
)}
|
2021-10-14 16:52:42 +00:00
|
|
|
</Measure>
|
|
|
|
) : (
|
|
|
|
<div className="module-ForwardMessageModal__no-candidate-contacts">
|
|
|
|
{i18n('noContactsFound')}
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
<div className="module-ForwardMessageModal__footer">
|
|
|
|
<div>
|
|
|
|
{Boolean(selectedContacts.length) &&
|
|
|
|
selectedContacts.map(contact => contact.title).join(', ')}
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
{isEditingMessage || !isMessageEditable ? (
|
|
|
|
<Button
|
|
|
|
aria-label={i18n('ForwardMessageModal--continue')}
|
|
|
|
className="module-ForwardMessageModal__send-button module-ForwardMessageModal__send-button--forward"
|
|
|
|
disabled={!canForwardMessage}
|
|
|
|
onClick={forwardMessage}
|
2021-07-20 20:18:35 +00:00
|
|
|
/>
|
2021-10-14 16:52:42 +00:00
|
|
|
) : (
|
|
|
|
<Button
|
|
|
|
aria-label={i18n('forwardMessage')}
|
|
|
|
className="module-ForwardMessageModal__send-button module-ForwardMessageModal__send-button--continue"
|
|
|
|
disabled={!hasContactsSelected}
|
|
|
|
onClick={() => setIsEditingMessage(true)}
|
|
|
|
/>
|
|
|
|
)}
|
2021-07-20 20:18:35 +00:00
|
|
|
</div>
|
2021-04-27 22:35:35 +00:00
|
|
|
</div>
|
2021-10-14 16:52:42 +00:00
|
|
|
</animated.div>
|
2021-07-20 20:18:35 +00:00
|
|
|
</ModalHost>
|
|
|
|
</>
|
2021-04-27 22:35:35 +00:00
|
|
|
);
|
|
|
|
};
|