diff --git a/web/src/popover_menus.js b/web/src/popover_menus.js index fb318b823a..6dd73face6 100644 --- a/web/src/popover_menus.js +++ b/web/src/popover_menus.js @@ -30,7 +30,6 @@ import {$t, $t_html} from "./i18n"; import * as message_edit from "./message_edit"; import * as message_edit_history from "./message_edit_history"; import * as message_lists from "./message_lists"; -import * as muted_topics_ui from "./muted_topics_ui"; import * as narrow_state from "./narrow_state"; import * as popover_menus_data from "./popover_menus_data"; import * as popovers from "./popovers"; @@ -43,6 +42,7 @@ import * as stream_popover from "./stream_popover"; import {parse_html} from "./ui_util"; import * as unread_ops from "./unread_ops"; import {user_settings} from "./user_settings"; +import * as user_topics from "./user_topics"; let message_actions_popover_keyboard_toggle = false; @@ -307,13 +307,39 @@ export function initialize() { return; } - $popper.one("click", ".sidebar-popover-mute-topic", () => { - muted_topics_ui.mute_topic(stream_id, topic_name); + $popper.one("click", ".sidebar-popover-unmute-topic", () => { + user_topics.set_user_topic_visibility_policy( + stream_id, + topic_name, + user_topics.all_visibility_policies.UNMUTED, + ); instance.hide(); }); - $popper.one("click", ".sidebar-popover-unmute-topic", () => { - muted_topics_ui.unmute_topic(stream_id, topic_name); + $popper.one("click", ".sidebar-popover-remove-unmute", () => { + user_topics.set_user_topic_visibility_policy( + stream_id, + topic_name, + user_topics.all_visibility_policies.INHERIT, + ); + instance.hide(); + }); + + $popper.one("click", ".sidebar-popover-mute-topic", () => { + user_topics.set_user_topic_visibility_policy( + stream_id, + topic_name, + user_topics.all_visibility_policies.MUTED, + ); + instance.hide(); + }); + + $popper.one("click", ".sidebar-popover-remove-mute", () => { + user_topics.set_user_topic_visibility_policy( + stream_id, + topic_name, + user_topics.all_visibility_policies.INHERIT, + ); instance.hide(); }); diff --git a/web/src/popover_menus_data.js b/web/src/popover_menus_data.js index cb4b9a4bf9..a10e5906a2 100644 --- a/web/src/popover_menus_data.js +++ b/web/src/popover_menus_data.js @@ -128,13 +128,17 @@ export function get_actions_popover_content_context(message_id) { export function get_topic_popover_content_context({stream_id, topic_name, url}) { const sub = sub_store.get(stream_id); const topic_muted = user_topics.is_topic_muted(sub.stream_id, topic_name); + const topic_unmuted = user_topics.is_topic_unmuted(sub.stream_id, topic_name); const has_starred_messages = starred_messages.get_count_in_topic(sub.stream_id, topic_name) > 0; const can_move_topic = settings_data.user_can_move_messages_between_streams(); return { stream_name: sub.name, stream_id: sub.stream_id, + stream_muted: sub.is_muted, topic_name, topic_muted, + topic_unmuted, + development_environment: page_params.development_environment, can_move_topic, is_realm_admin: page_params.is_admin, topic_is_resolved: resolved_topic.is_resolved(topic_name), diff --git a/web/templates/topic_sidebar_actions.hbs b/web/templates/topic_sidebar_actions.hbs index 76696d4713..20b9dfb55e 100644 --- a/web/templates/topic_sidebar_actions.hbs +++ b/web/templates/topic_sidebar_actions.hbs @@ -8,6 +8,26 @@
+ {{#if development_environment}} + {{#if stream_muted}} + {{#unless topic_unmuted}} +
  • + + + {{t "Unmute topic (muted stream)"}} + +
  • + {{else}} +
  • + + + {{t "Mute topic (muted stream)"}} + +
  • + {{/unless}} + {{/if}} + {{/if}} + {{#unless topic_muted}}
  • @@ -17,7 +37,7 @@
  • {{else}}
  • - + {{t "Unmute topic"}}