Disable editing quotes for messages

This commit is contained in:
Fedor Indutny 2023-05-09 14:13:19 -07:00 committed by GitHub
parent 583a321dd9
commit 320ac044a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -713,6 +713,11 @@ export function setQuoteByMessageId(
throw new Error('sendStickerMessage: No conversation found');
}
const draftEditMessage = conversation.get('draftEditMessage');
if (draftEditMessage) {
return;
}
const message = messageId ? await getMessageById(messageId) : undefined;
const state = getState();
@ -752,7 +757,6 @@ export function setQuoteByMessageId(
window.Signal.Data.updateConversation(conversation.attributes);
}
const draftEditMessage = conversation.get('draftEditMessage');
if (message) {
const quote = await makeQuote(message.attributes);
@ -761,31 +765,15 @@ export function setQuoteByMessageId(
return;
}
if (draftEditMessage) {
conversation.set({
draftEditMessage: {
...draftEditMessage,
quote,
},
});
} else {
dispatch(
setQuotedMessage(conversationId, {
conversationId,
quote,
})
);
}
dispatch(setComposerFocus(conversation.id));
dispatch(setComposerDisabledState(conversationId, false));
} else if (draftEditMessage) {
conversation.set({
draftEditMessage: {
...draftEditMessage,
quote: undefined,
},
});
} else {
dispatch(setQuotedMessage(conversationId, undefined));
}