From 8a51fa4b8384cc4f24042fe9bf8ba8b2102f4dc8 Mon Sep 17 00:00:00 2001 From: evykassirer Date: Tue, 25 Mar 2025 16:10:03 -0700 Subject: [PATCH] drafts: Fix bug opening drafts in 'general chat'. This was likely a longstanding issue that wasn't caught because we required topics on CZO. The new logic ensures topic match even for empty string (general chat) topics. --- web/src/drafts.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/web/src/drafts.ts b/web/src/drafts.ts index 482e262e54..f3ef5b115b 100644 --- a/web/src/drafts.ts +++ b/web/src/drafts.ts @@ -506,9 +506,9 @@ export function filter_drafts_by_compose_box_and_recipient( // Match by stream and topic. if ( stream_id && - topic && + topic !== undefined && draft.type === "stream" && - draft.topic && + draft.topic !== undefined && draft.stream_id !== undefined && util.same_recipient( {type: "stream", stream_id: draft.stream_id, topic: draft.topic}, @@ -518,7 +518,12 @@ export function filter_drafts_by_compose_box_and_recipient( narrow_drafts_ids.push(id); } // Match by only stream. - else if (draft.type === "stream" && stream_id && !topic && draft.stream_id === stream_id) { + else if ( + draft.type === "stream" && + stream_id && + topic === undefined && + draft.stream_id === stream_id + ) { narrow_drafts_ids.push(id); } // Match by direct message recipient.