Better draft attachment management logic

Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
This commit is contained in:
automated-signal 2025-09-26 15:23:54 -05:00 committed by GitHub
commit 7bc29870a0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 29 additions and 21 deletions

View file

@ -180,7 +180,10 @@ export type OwnProps = Readonly<{
quotedMessageAuthorAci: AciString | null;
quotedMessageSentAt: number | null;
removeAttachment: (conversationId: string, filePath: string) => unknown;
removeAttachment: (
conversationId: string,
attachment: AttachmentDraftType
) => unknown;
scrollToMessage: (conversationId: string, messageId: string) => unknown;
setComposerFocus: (conversationId: string) => unknown;
setMessageToEdit(conversationId: string, messageId: string): unknown;
@ -1172,9 +1175,7 @@ export const CompositionArea = memo(function CompositionArea({
onClickAttachment={maybeEditAttachment}
onClose={() => onClearAttachments(conversationId)}
onCloseAttachment={attachment => {
if (attachment.path) {
removeAttachment(conversationId, attachment.path);
}
removeAttachment(conversationId, attachment);
}}
/>
</div>