Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
recent_conversations: Use unmute icon for topics in muted streams.
Hardik Dharmanidd001e1a5feb
diff --git a/web/src/recent_topics_ui.js b/web/src/recent_topics_ui.jsindex 3154d324a31..d3980fa0897 100644--- a/web/src/recent_topics_ui.js+++ b/web/src/recent_topics_ui.js@@ -376,6 +376,7 @@ function format_conversation(conversation_data) {// Stream infocontext.stream_id = last_msg.stream_id;context.stream = last_msg.stream;+ context.stream_muted = stream_info.is_muted;context.stream_color = stream_info.color;context.stream_url = hash_util.by_stream_url(context.stream_id);context.invite_only = stream_info.invite_only;@@ -389,6 +390,9 @@ function format_conversation(conversation_data) {// display / hide them according to filters instead of// doing complete re-render.context.topic_muted = Boolean(user_topics.is_topic_muted(context.stream_id, context.topic));+ context.topic_unmuted = Boolean(+ user_topics.is_topic_unmuted(context.stream_id, context.topic),+ );context.mention_in_unread = unread.topic_has_any_unread_mentions(context.stream_id,context.topic,@@ -1253,24 +1257,46 @@ export function initialize() {popovers.show_user_info_popover(this, user);});- $("body").on("keydown", ".on_hover_topic_mute", ui_util.convert_enter_to_click);+ $("body").on(+ "keydown",+ ".on_hover_topic_mute, .on_hover_topic_unmute",+ ui_util.convert_enter_to_click,+ );++ // Mute topic in a unmuted stream+ $("body").on("click", "#recent_topics_table .stream_unmuted.on_hover_topic_mute", (e) => {+ e.stopPropagation();+ const $elt = $(e.target);+ const topic_row_index = $elt.closest("tr").index();+ focus_clicked_element(topic_row_index, COLUMNS.mute);+ muted_topics_ui.mute_or_unmute_topic($elt, user_topics.all_visibility_policies.MUTED);+ });- $("body").on("click", "#recent_topics_table .on_hover_topic_unmute", (e) => {+ // Unmute topic in a unmuted stream+ $("body").on("click", "#recent_topics_table .stream_unmuted.on_hover_topic_unmute", (e) => {e.stopPropagation();const $elt = $(e.target);const topic_row_index = $elt.closest("tr").index();focus_clicked_element(topic_row_index, COLUMNS.mute);- muted_topics_ui.mute_or_unmute_topic($elt, false);+ muted_topics_ui.mute_or_unmute_topic($elt, user_topics.all_visibility_policies.INHERIT);});- $("body").on("keydown", ".on_hover_topic_unmute", ui_util.convert_enter_to_click);+ // Unmute topic in a muted stream+ $("body").on("click", "#recent_topics_table .stream_muted.on_hover_topic_unmute", (e) => {+ e.stopPropagation();+ const $elt = $(e.target);+ const topic_row_index = $elt.closest("tr").index();+ focus_clicked_element(topic_row_index, COLUMNS.mute);+ muted_topics_ui.mute_or_unmute_topic($elt, user_topics.all_visibility_policies.UNMUTED);+ });- $("body").on("click", "#recent_topics_table .on_hover_topic_mute", (e) => {+ // Mute topic in a muted stream+ $("body").on("click", "#recent_topics_table .stream_muted.on_hover_topic_mute", (e) => {e.stopPropagation();const $elt = $(e.target);const topic_row_index = $elt.closest("tr").index();focus_clicked_element(topic_row_index, COLUMNS.mute);- muted_topics_ui.mute_or_unmute_topic($elt, true);+ muted_topics_ui.mute_or_unmute_topic($elt, user_topics.all_visibility_policies.INHERIT);});$("body").on("click", "#recent_topics_search", (e) => {diff --git a/web/templates/recent_topic_row.hbs b/web/templates/recent_topic_row.hbsindex c20d386bcf9..5f63b5a1b91 100644--- a/web/templates/recent_topic_row.hbs+++ b/web/templates/recent_topic_row.hbs@@ -57,10 +57,12 @@</div><div class="recent_topic_actions"><div class="recent_topics_focusable hidden-for-spectators">- {{#if topic_muted}}- <i class="zulip-icon zulip-icon-mute on_hover_topic_unmute recipient_bar_icon tippy-zulip-tooltip" data-stream-id="{{stream_id}}" data-topic-name="{{topic}}" data-tippy-content="{{t 'Unmute topic' }}" data-tippy-trigger="mouseenter" role="button" tabindex="0" aria-label="{{t 'Unmute topic' }}"></i>+ {{#if stream_muted}}+ <i class="zulip-icon zulip-icon-unmute stream_muted {{#if topic_unmuted}}on_hover_topic_mute {{else}}on_hover_topic_unmute {{/if}} recipient_bar_icon tippy-zulip-tooltip" data-stream-id="{{stream_id}}" data-topic-name="{{topic}}" role="button" tabindex="0"+ {{#if topic_unmuted}} data-tippy-content="{{t 'Mute topic' }}" aria-label="{{t 'Mute topic' }}" {{else}} data-tippy-content="{{t 'Unmute topic' }}" aria-label="{{t 'Unmute topic' }}" {{/if}} data-tippy-trigger="mouseenter"></i>{{else}}- <i class="zulip-icon zulip-icon-mute on_hover_topic_mute recipient_bar_icon tippy-zulip-tooltip" data-stream-id="{{stream_id}}" data-topic-name="{{topic}}" data-tippy-content="{{t 'Mute topic' }}" data-tippy-trigger="mouseenter" role="button" tabindex="0" aria-label="{{t 'Mute topic' }}"></i>+ <i class="zulip-icon zulip-icon-mute stream_unmuted {{#if topic_muted}}on_hover_topic_unmute {{else}}on_hover_topic_mute {{/if}} recipient_bar_icon tippy-zulip-tooltip" data-stream-id="{{stream_id}}" data-topic-name="{{topic}}" role="button" tabindex="0"+ {{#if topic_muted}} data-tippy-content="{{t 'Unmute topic' }}" aria-label="{{t 'Unmute topic' }}" {{else}} data-tippy-content="{{t 'Mute topic' }}" aria-label="{{t 'Mute topic' }}" {{/if}} data-tippy-trigger="mouseenter"></i>{{/if}}</div></div>diff --git a/web/tests/recent_topics.test.js b/web/tests/recent_topics.test.jsindex 9f328181362..aae474034bd 100644--- a/web/tests/recent_topics.test.js+++ b/web/tests/recent_topics.test.js@@ -355,6 +355,7 @@ function generate_topic_data(topic_info_array) {stream: "stream" + stream_id,stream_color: "",stream_id,+ stream_muted: undefined,stream_url: "https://www.example.com",topic,conversation_key: get_topic_key(stream_id, topic),@@ -362,6 +363,7 @@ function generate_topic_data(topic_info_array) {unread_count,mention_in_unread: false,topic_muted: muted,+ topic_unmuted: false,});}return data;