Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
popover_menus_data: Hide actions user can't take for archived channels.
sanchi-t5dfa8ac9fe6c
diff --git a/web/src/message_edit.ts b/web/src/message_edit.tsindex 5f2637755a0..5e4b77e3045 100644--- a/web/src/message_edit.ts+++ b/web/src/message_edit.ts@@ -102,6 +102,10 @@ export function is_topic_editable(message: Message, edit_limit_seconds_buffer =return false;}+ if (message.type === "stream" && stream_data.is_stream_archived(message.stream_id)) {+ return false;+ }+if (!settings_data.user_can_move_messages_to_another_topic()) {return false;}@@ -206,6 +210,10 @@ export function is_message_sent_by_my_bot(message: Message): boolean {}export function get_deletability(message: Message): boolean {+ if (message.type === "stream" && stream_data.is_stream_archived(message.stream_id)) {+ return false;+ }+if (settings_data.user_can_delete_any_message()) {return true;}@@ -243,6 +251,10 @@ export function is_stream_editable(message: Message, edit_limit_seconds_buffer =return false;}+ if (message.type === "stream" && stream_data.is_stream_archived(message.stream_id)) {+ return false;+ }+if (!settings_data.user_can_move_messages_between_streams()) {return false;}diff --git a/web/src/popover_menus_data.ts b/web/src/popover_menus_data.tsindex d33e22737a7..5774796cabb 100644--- a/web/src/popover_menus_data.ts+++ b/web/src/popover_menus_data.ts@@ -206,7 +206,10 @@ export function get_actions_popover_content_context(message_id: number): ActionP// `media_breakpoints.sm_min`, we need to include the reaction button in the// popover if it is not displayed.const should_display_add_reaction_option =- !message.is_me_message && !is_add_reaction_icon_visible() && not_spectator;+ !message.is_me_message &&+ !is_add_reaction_icon_visible() &&+ not_spectator &&+ !(stream_id && stream_data.is_stream_archived(stream_id));return {message_id: message.id,diff --git a/web/styles/reactions.css b/web/styles/reactions.cssindex 9cdf169cf3f..c0cc0a834df 100644--- a/web/styles/reactions.css+++ b/web/styles/reactions.css@@ -6,6 +6,12 @@margin-bottom: var(--message-box-markdown-aligned-vertical-space);}+ .message_reaction_container {+ &.disabled {+ cursor: not-allowed;+ }+ }+.message_reaction {display: flex;/* Set a pixel and half padding to maintain@@ -39,6 +45,10 @@box-shadow: none;}+ &.disabled {+ pointer-events: none;+ }+&:hover {background-color: var(--color-message-reaction-background-hover);}diff --git a/web/templates/message_controls.hbs b/web/templates/message_controls.hbsindex 1efbfbaf385..02ac760a688 100644--- a/web/templates/message_controls.hbs+++ b/web/templates/message_controls.hbs@@ -1,13 +1,15 @@-{{#if msg/sent_by_me}}- <div class="edit_content message_control_button"></div>-{{/if}}+{{#unless is_archived}}+ {{#if msg/sent_by_me}}+ <div class="edit_content message_control_button"></div>+ {{/if}}-{{#unless msg/sent_by_me}}- <div class="reaction_button message_control_button" data-tooltip-template-id="add-emoji-tooltip-template">- <div class="emoji-message-control-button-container">- <i class="message-controls-icon zulip-icon zulip-icon-smile" aria-label="{{t 'Add emoji reaction' }} (:)" role="button" aria-haspopup="true" tabindex="0"></i>+ {{#unless msg/sent_by_me}}+ <div class="reaction_button message_control_button" data-tooltip-template-id="add-emoji-tooltip-template">+ <div class="emoji-message-control-button-container">+ <i class="message-controls-icon zulip-icon zulip-icon-smile" aria-label="{{t 'Add emoji reaction' }} (:)" role="button" aria-haspopup="true" tabindex="0"></i>+ </div></div>- </div>+ {{/unless}}{{/unless}}<div class="actions_hover message_control_button" data-tooltip-template-id="message-actions-tooltip-template" >diff --git a/web/templates/message_group.hbs b/web/templates/message_group.hbsindex 99cc243af29..a29fd19ee89 100644--- a/web/templates/message_group.hbs+++ b/web/templates/message_group.hbs@@ -10,7 +10,7 @@{{> recipient_row use_match_properties=../use_match_properties}}{{#each message_containers}}{{#with this}}- {{> single_message use_match_properties=../../use_match_properties message_list_id=../../message_list_id}}+ {{> single_message use_match_properties=../../use_match_properties message_list_id=../../message_list_id is_archived=../is_archived}}{{/with}}{{/each}}</div>diff --git a/web/templates/message_reaction.hbs b/web/templates/message_reaction.hbsindex 91e9b208789..6df258a093c 100644--- a/web/templates/message_reaction.hbs+++ b/web/templates/message_reaction.hbs@@ -1,10 +1,12 @@-<div class="{{this.class}}" aria-label="{{this.label}}" data-reaction-id="{{this.local_id}}">- {{#if this.emoji_alt_code}}- <div class="emoji_alt_code"> :{{this.emoji_name}}:</div>- {{else if this.is_realm_emoji}}- <img src="{{this.url}}" class="emoji" />- {{else}}- <div class="emoji emoji-{{this.emoji_code}}"></div>- {{/if}}- <div class="message_reaction_count">{{this.vote_text}}</div>+<div class="message_reaction_container {{#if is_archived}}disabled{{/if}}">+ <div class="{{this.class}} {{#if is_archived}}disabled{{/if}}" aria-label="{{this.label}}" data-reaction-id="{{this.local_id}}">+ {{#if this.emoji_alt_code}}+ <div class="emoji_alt_code"> :{{this.emoji_name}}:</div>+ {{else if this.is_realm_emoji}}+ <img src="{{this.url}}" class="emoji" />+ {{else}}+ <div class="emoji emoji-{{this.emoji_code}}"></div>+ {{/if}}+ <div class="message_reaction_count">{{this.vote_text}}</div>+ </div></div>diff --git a/web/templates/message_reactions.hbs b/web/templates/message_reactions.hbsindex 7828520d989..c1ab44c917f 100644--- a/web/templates/message_reactions.hbs+++ b/web/templates/message_reactions.hbs@@ -1,11 +1,13 @@<div class="message_reactions">{{#each this/msg/message_reactions}}- {{> message_reaction}}+ {{> message_reaction is_archived=../is_archived}}{{/each}}- <div class="reaction_button" role="button" aria-haspopup="true" data-tooltip-template-id="add-emoji-tooltip-template" aria-label="{{t 'Add emoji reaction' }} (:)">- <div class="emoji-message-control-button-container">- <i class="zulip-icon zulip-icon-smile" tabindex="0"></i>- <div class="message_reaction_count">+</div>+ {{#unless is_archived}}+ <div class="reaction_button" role="button" aria-haspopup="true" data-tooltip-template-id="add-emoji-tooltip-template" aria-label="{{t 'Add emoji reaction' }} (:)">+ <div class="emoji-message-control-button-container">+ <i class="zulip-icon zulip-icon-smile" tabindex="0"></i>+ <div class="message_reaction_count">+</div>+ </div></div>- </div>+ {{/unless}}</div>diff --git a/web/tests/popover_menus_data.test.js b/web/tests/popover_menus_data.test.jsindex 346c3b61c71..61e25a3514b 100644--- a/web/tests/popover_menus_data.test.js+++ b/web/tests/popover_menus_data.test.js@@ -46,6 +46,7 @@ mock_esm("../src/hash_util", {});mock_esm("../src/stream_data", {is_subscribed: () => true,+ is_stream_archived: () => false,});mock_esm("../src/group_permission_settings", {get_group_permission_setting_config() {