Add confirm dialog before discarding draft on edit

This commit is contained in:
Jamie
2026-03-11 09:46:06 -07:00
committed by GitHub
parent 8ae5cb8dcb
commit 600b91d867
12 changed files with 250 additions and 13 deletions

View File

@@ -3,10 +3,15 @@
import type { ConversationAttributesType } from '../model-types.d.ts';
export function hasDraft(attributes: ConversationAttributesType): boolean {
const draftAttachments = attributes.draftAttachments || [];
return (attributes.draft ||
attributes.quotedMessageId ||
draftAttachments.length > 0) as boolean;
export function hasDraft(
attrs: Pick<
ConversationAttributesType,
'draft' | 'draftAttachments' | 'quotedMessageId'
>
): boolean {
return (
(attrs.draft != null && attrs.draft.length > 1) ||
(attrs.draftAttachments != null && attrs.draftAttachments.length > 1) ||
attrs.quotedMessageId != null
);
}