Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
popovers: Show "Move message" menu always when moving message is allowed.
Sahil Batra1dd89b8f9b4a
diff --git a/static/js/popovers.js b/static/js/popovers.jsindex dd526ce386d..c7eb76b6838 100644--- a/static/js/popovers.js+++ b/static/js/popovers.js@@ -467,19 +467,24 @@ export function toggle_actions_popover(element, id) {!message_container.is_hidden &¬_spectator;const editability = message_edit.get_editability(message);- let use_edit_icon;+ const is_stream_editable =+ message.is_stream && settings_data.user_can_move_messages_between_streams();let editability_menu_item;+ let move_message_menu_item;let view_source_menu_item;if (editability === message_edit.editability_types.FULL) {- use_edit_icon = true;editability_menu_item = $t({defaultMessage: "Edit message"});- } else if (editability === message_edit.editability_types.TOPIC_ONLY) {- use_edit_icon = false;- editability_menu_item = $t({defaultMessage: "Move message"});+ if (message.is_stream) {+ move_message_menu_item = $t({defaultMessage: "Move message"});+ }+ } else if (+ editability === message_edit.editability_types.TOPIC_ONLY ||+ is_stream_editable+ ) {+ move_message_menu_item = $t({defaultMessage: "Move message"});view_source_menu_item = $t({defaultMessage: "View message source"});} else {- use_edit_icon = false;view_source_menu_item = $t({defaultMessage: "View message source"});}@@ -516,9 +521,6 @@ export function toggle_actions_popover(element, id) {const should_display_uncollapse =!message.locally_echoed && !message.is_me_message && message.collapsed;- const should_display_edit_and_move_message =- editability === message_edit.editability_types.FULL ||- editability === message_edit.editability_types.TOPIC_ONLY;const should_display_view_source = editability !== message_edit.editability_types.FULL;const should_display_quote_and_reply =@@ -535,8 +537,8 @@ export function toggle_actions_popover(element, id) {message_id: message.id,historical: message.historical,stream_id: message.stream_id,- use_edit_icon,editability_menu_item,+ move_message_menu_item,should_display_mark_as_unread,view_source_menu_item,should_display_collapse,@@ -549,7 +551,6 @@ export function toggle_actions_popover(element, id) {should_display_delete_option,should_display_read_receipts_option,should_display_reminder_option: feature_flags.reminders_in_message_action_menu,- should_display_edit_and_move_message,should_display_view_source,should_display_quote_and_reply,};@@ -1236,14 +1237,18 @@ export function register_click_handlers() {e.stopPropagation();e.preventDefault();});- $("body").on("click", ".popover_edit_message, .popover_view_source", (e) => {- const message_id = $(e.currentTarget).data("message-id");- const $row = message_lists.current.get_row(message_id);- hide_actions_popover();- message_edit.start($row);- e.stopPropagation();- e.preventDefault();- });+ $("body").on(+ "click",+ ".popover_edit_message, .popover_move_message, .popover_view_source",+ (e) => {+ const message_id = $(e.currentTarget).data("message-id");+ const $row = message_lists.current.get_row(message_id);+ hide_actions_popover();+ message_edit.start($row);+ e.stopPropagation();+ e.preventDefault();+ },+ );$("body").on("click", ".rehide_muted_user_message", (e) => {const message_id = $(e.currentTarget).data("message-id");const $row = message_lists.current.get_row(message_id);diff --git a/static/templates/actions_popover_content.hbs b/static/templates/actions_popover_content.hbsindex 39d085983fa..113f02a1825 100644--- a/static/templates/actions_popover_content.hbs+++ b/static/templates/actions_popover_content.hbs@@ -9,10 +9,19 @@</li>{{/if}}- {{#if should_display_edit_and_move_message}}+ {{#if editability_menu_item}}<li><a class="popover_edit_message" data-message-id="{{message_id}}" tabindex="0">- <i class="{{#if use_edit_icon}}fa fa-pencil{{else}}fa fa-arrows{{/if}}" aria-hidden="true"></i> {{editability_menu_item}}+ <i class="fa fa-pencil" aria-hidden="true"></i> {{editability_menu_item}}+ <span class="hotkey-hint">(e)</span>+ </a>+ </li>+ {{/if}}++ {{#if move_message_menu_item}}+ <li>+ <a class="popover_move_message" data-message-id="{{message_id}}" tabindex="0">+ <i class="fa fa-arrows" aria-hidden="true"></i> {{move_message_menu_item}}<span class="hotkey-hint">(e)</span></a></li>diff --git a/templates/zerver/help/move-content-to-another-stream.md b/templates/zerver/help/move-content-to-another-stream.mdindex fe03f0ff5dd..e20b9ae67df 100644--- a/templates/zerver/help/move-content-to-another-stream.md+++ b/templates/zerver/help/move-content-to-another-stream.md@@ -47,8 +47,8 @@ destination streams.{!message-actions-menu.md!}-1. Select **Move message** or **Edit message** (only one of these options will be shown). If you do- not see either option, you do not have permission to move this message.+1. Select **Move message**. If you do not see this option, you do not have permission+ to move this message.1. Select the destination stream for the message from the streams dropdown list.diff --git a/templates/zerver/help/move-content-to-another-topic.md b/templates/zerver/help/move-content-to-another-topic.mdindex cd7776b8f33..2bcde5cab30 100644--- a/templates/zerver/help/move-content-to-another-topic.md+++ b/templates/zerver/help/move-content-to-another-topic.md@@ -22,8 +22,8 @@ for the details on when topic editing is allowed.{!message-actions-menu.md!}-1. Select **Move message** or **Edit message** (only one of these options will be shown). If you do- not see either option, you do not have permission to move this message.+1. Select **Move message**. If you do not see this option, you do not have permission+ to move this message.1. Set the destination topic.diff --git a/templates/zerver/help/rename-a-topic.md b/templates/zerver/help/rename-a-topic.mdindex de96ccdc600..12aad5e3a81 100644--- a/templates/zerver/help/rename-a-topic.md+++ b/templates/zerver/help/rename-a-topic.md@@ -36,8 +36,8 @@ for the details on when topic editing is allowed.{!message-actions-menu.md!}-1. Select **Move message** or **Edit message** (only one of these options will be shown). If you do- not see either option, you do not have permission to edit the topic of this message.+1. Select **Move message**. If you do not see this option, you do not have permission+ to edit the topic of this message.1. Edit the topic.