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.current?.close();
|
||||||
}, [emojiButtonRef]);
|
}, [emojiButtonRef]);
|
||||||
|
|
||||||
const clearQuote = useCallback(() => {
|
const handleEscape = useCallback(() => {
|
||||||
if (quotedMessageId) {
|
if (linkPreviewResult) {
|
||||||
setQuoteByMessageId(conversationId, undefined);
|
onCloseLinkPreview(conversationId);
|
||||||
}
|
} else if (draftEditMessage) {
|
||||||
if (draftEditMessage) {
|
|
||||||
discardEditMessage(conversationId);
|
discardEditMessage(conversationId);
|
||||||
|
} else if (quotedMessageId) {
|
||||||
|
setQuoteByMessageId(conversationId, undefined);
|
||||||
}
|
}
|
||||||
}, [
|
}, [
|
||||||
conversationId,
|
conversationId,
|
||||||
discardEditMessage,
|
discardEditMessage,
|
||||||
draftEditMessage,
|
draftEditMessage,
|
||||||
|
linkPreviewResult,
|
||||||
|
onCloseLinkPreview,
|
||||||
quotedMessageId,
|
quotedMessageId,
|
||||||
setQuoteByMessageId,
|
setQuoteByMessageId,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
useEscapeHandling(clearQuote);
|
useEscapeHandling(handleEscape);
|
||||||
|
|
||||||
if (isSignalConversation) {
|
if (isSignalConversation) {
|
||||||
// TODO DESKTOP-4547
|
// TODO DESKTOP-4547
|
||||||
|
|
|
@ -963,7 +963,10 @@ function onEditorStateChange({
|
||||||
hasDraftAttachments(conversation.attributes.draftAttachments, {
|
hasDraftAttachments(conversation.attributes.draftAttachments, {
|
||||||
includePending: true,
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue