Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
compose_state: Reuse has_savable_message_content.
Tim Abbott7beea026602e
diff --git a/web/src/compose_state.ts b/web/src/compose_state.tsindex df9fd6c3eda..da0ae624028 100644--- a/web/src/compose_state.ts+++ b/web/src/compose_state.ts@@ -190,7 +190,7 @@ export function has_message_content(): boolean {return message_content() !== "";}-export const MINIMUM_MESSAGE_LENGTH_TO_SAVE_DRAFT = 2;+const MINIMUM_MESSAGE_LENGTH_TO_SAVE_DRAFT = 2;export function has_savable_message_content(): boolean {return message_content().length > MINIMUM_MESSAGE_LENGTH_TO_SAVE_DRAFT;}diff --git a/web/src/drafts.ts b/web/src/drafts.tsindex c619a1c72d9..9d7ff615ab2 100644--- a/web/src/drafts.ts+++ b/web/src/drafts.ts@@ -290,10 +290,7 @@ export function rename_stream_recipient(}export function snapshot_message(): LocalStorageDraft | undefined {- if (- !compose_state.composing() ||- compose_state.message_content().length <= compose_state.MINIMUM_MESSAGE_LENGTH_TO_SAVE_DRAFT- ) {+ if (!compose_state.composing() || !compose_state.has_savable_message_content()) {// If you aren't in the middle of composing the body of a// message or the message is shorter than 2 characters long, don't try to snapshot.return undefined;