diff --git a/ts/components/ForwardMessageModal.tsx b/ts/components/ForwardMessageModal.tsx index dc79c230d..d1b621fb2 100644 --- a/ts/components/ForwardMessageModal.tsx +++ b/ts/components/ForwardMessageModal.tsx @@ -118,8 +118,16 @@ export const ForwardMessageModal: FunctionComponent = ({ [inputApiRef, onPickEmoji] ); + const hasContactsSelected = Boolean(selectedContacts.length); + + const canForwardMessage = + hasContactsSelected && + (Boolean(messageBodyText) || + isSticker || + (attachmentsToForward && attachmentsToForward.length)); + const forwardMessage = React.useCallback(() => { - if (!messageBodyText) { + if (!canForwardMessage) { return; } @@ -131,20 +139,13 @@ export const ForwardMessageModal: FunctionComponent = ({ ); }, [ attachmentsToForward, + canForwardMessage, doForwardMessage, linkPreview, messageBodyText, selectedContacts, ]); - const hasContactsSelected = Boolean(selectedContacts.length); - - const canForwardMessage = - hasContactsSelected && - (Boolean(messageBodyText) || - isSticker || - (attachmentsToForward && attachmentsToForward.length)); - const normalizedSearchTerm = searchTerm.trim(); useEffect(() => { const timeout = setTimeout(() => {