From 62437e693040cefda4b8e0d9b2b487f6146b207b Mon Sep 17 00:00:00 2001 From: Prakhar Pratyush Date: Fri, 16 Dec 2022 10:08:20 +0530 Subject: [PATCH] topic_edit: Fix resolve topic notification. When 'resolve|unresolve' and 'change topic' actions occurs in the same api call using 'topic sidebar icon', only 'topic_moved' notification is sent. Both 'topic moved' and 'topic resolved' notification should be generated. Currently, 'select_stream_id' is not set to 'undefined', even if we only change 'topic name' and/or 'resolve|unresolve' topic. Resulting in no 'resolved_topic' notification. This commit sets 'select_stream_id' to 'undefined' to fix the issue. --- static/js/stream_popover.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/static/js/stream_popover.js b/static/js/stream_popover.js index 46c8ef8c2d..e02eeb067c 100644 --- a/static/js/stream_popover.js +++ b/static/js/stream_popover.js @@ -474,16 +474,17 @@ export function build_move_topic_to_stream_popover(current_stream_id, topic_name // there has been no change in the topic name. new_topic_name = undefined; } + if (select_stream_id === current_stream_id) { + // We use `undefined` to tell the server that + // there has been no change in stream. This is + // important for cases when changing stream is + // not allowed or when changes other than + // stream-change has been made. + select_stream_id = undefined; + } let propagate_mode = "change_all"; if (message !== undefined) { - if (select_stream_id === current_stream_id) { - // We use `undefined` to tell the server that - // there has been no change in stream. This is - // important for cases when changing stream is - // not allowed. - select_stream_id = undefined; - } // We already have the message_id here which means that modal is opened using // message popover. propagate_mode = $("#move_topic_modal select.message_edit_topic_propagate").val(); @@ -503,7 +504,7 @@ export function build_move_topic_to_stream_popover(current_stream_id, topic_name current_stream_id, old_topic_name, (message_id) => { - if (old_topic_name && select_stream_id) { + if (old_topic_name) { message_edit.move_topic_containing_message_to_stream( message_id, select_stream_id,