Do not fetch link preview when edited message does not contain preview
This commit is contained in:
parent
7c8dec4b21
commit
bd7545e6d2
2 changed files with 13 additions and 7 deletions
|
@ -665,22 +665,25 @@ export function CompositionArea({
|
|||
emojiButtonRef.current?.close();
|
||||
}, [emojiButtonRef]);
|
||||
|
||||
const clearQuote = useCallback(() => {
|
||||
if (quotedMessageId) {
|
||||
setQuoteByMessageId(conversationId, undefined);
|
||||
}
|
||||
if (draftEditMessage) {
|
||||
const handleEscape = useCallback(() => {
|
||||
if (linkPreviewResult) {
|
||||
onCloseLinkPreview(conversationId);
|
||||
} else if (draftEditMessage) {
|
||||
discardEditMessage(conversationId);
|
||||
} else if (quotedMessageId) {
|
||||
setQuoteByMessageId(conversationId, undefined);
|
||||
}
|
||||
}, [
|
||||
conversationId,
|
||||
discardEditMessage,
|
||||
draftEditMessage,
|
||||
linkPreviewResult,
|
||||
onCloseLinkPreview,
|
||||
quotedMessageId,
|
||||
setQuoteByMessageId,
|
||||
]);
|
||||
|
||||
useEscapeHandling(clearQuote);
|
||||
useEscapeHandling(handleEscape);
|
||||
|
||||
if (isSignalConversation) {
|
||||
// TODO DESKTOP-4547
|
||||
|
|
|
@ -963,7 +963,10 @@ function onEditorStateChange({
|
|||
hasDraftAttachments(conversation.attributes.draftAttachments, {
|
||||
includePending: true,
|
||||
}) ||
|
||||
Boolean(conversation.attributes.draftEditMessage?.attachmentThumbnail)
|
||||
Boolean(conversation.attributes.draftEditMessage?.attachmentThumbnail) ||
|
||||
// If we already didn't have a preview attached, don't fetch another one
|
||||
(conversation.attributes.draftEditMessage &&
|
||||
!conversation.attributes.draftEditMessage.preview)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue