From 939691dfed1ae48513f9f57359f64e63ab26314a Mon Sep 17 00:00:00 2001 From: Saubhagya Patel Date: Thu, 27 Mar 2025 15:54:29 +0530 Subject: [PATCH] message_move: Show "general chat" in link of confirmation toast. When a message is moved using the "Move only this message" option a confirmation toast is shown. This commit adds support to show "general chat" in link of the toast when a message is moved to it. --- web/src/message_edit.ts | 7 +++++-- web/templates/message_moved_widget_body.hbs | 10 ++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/web/src/message_edit.ts b/web/src/message_edit.ts index 05ea5bcbde..9afab87c9e 100644 --- a/web/src/message_edit.ts +++ b/web/src/message_edit.ts @@ -1590,7 +1590,8 @@ type ToastParams = { function show_message_moved_toast(toast_params: ToastParams): void { const new_stream_name = sub_store.maybe_get_stream_name(toast_params.new_stream_id); - const stream_topic = `#${new_stream_name} > ${toast_params.new_topic_name}`; + const new_topic_display_name = util.get_final_topic_display_name(toast_params.new_topic_name); + const is_empty_string_topic = toast_params.new_topic_name === ""; const new_location_url = hash_util.by_stream_topic_url( toast_params.new_stream_id, toast_params.new_topic_name, @@ -1598,8 +1599,10 @@ function show_message_moved_toast(toast_params: ToastParams): void { feedback_widget.show({ populate($container) { const widget_body_html = render_message_moved_widget_body({ - stream_topic, + new_stream_name, + new_topic_display_name, new_location_url, + is_empty_string_topic, }); $container.html(widget_body_html); }, diff --git a/web/templates/message_moved_widget_body.hbs b/web/templates/message_moved_widget_body.hbs index 99dab44cd5..29e4242466 100644 --- a/web/templates/message_moved_widget_body.hbs +++ b/web/templates/message_moved_widget_body.hbs @@ -1,6 +1,12 @@
{{#tr}} - Message moved to {stream_topic}. - {{#*inline "z-link"}}{{> @partial-block}}{{/inline}} + Message moved to . + {{#*inline "z-link"~}} + + {{~!-- squash whitespace --~}} + #{{new_stream_name}} > {{new_topic_display_name}} + {{~!-- squash whitespace --~}} + + {{~/inline}} {{/tr}}