Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

popovers: Simplify muting logic for stream popover.

akshatdaltondd0e7bcb2eb8
diff --git a/static/js/stream_popover.js b/static/js/stream_popover.js
index 0227f3c969d..36f616254af 100644
--- a/static/js/stream_popover.js
+++ b/static/js/stream_popover.js
@@ -234,17 +234,14 @@ function build_topic_popover(opts) {
popovers.hide_all();
show_streamlist_sidebar();
- const is_muted = muting.is_topic_muted(sub.stream_id, topic_name);
- const can_mute_topic = !is_muted;
- const can_unmute_topic = is_muted;
+ const topic_muted = muting.is_topic_muted(sub.stream_id, topic_name);
const has_starred_messages = starred_messages.get_count_in_topic(sub.stream_id, topic_name) > 0;
const content = render_topic_sidebar_actions({
stream_name: sub.name,
stream_id: sub.stream_id,
topic_name,
- can_mute_topic,
- can_unmute_topic,
+ topic_muted,
is_realm_admin: page_params.is_admin,
color: sub.color,
has_starred_messages,
diff --git a/static/templates/topic_sidebar_actions.hbs b/static/templates/topic_sidebar_actions.hbs
index 7edfa36551f..46c0cfe7a7d 100644
--- a/static/templates/topic_sidebar_actions.hbs
+++ b/static/templates/topic_sidebar_actions.hbs
@@ -8,23 +8,21 @@
<hr />
- {{#if can_mute_topic}}
+ {{#unless topic_muted}}
<li>
<a tabindex="0" class="sidebar-popover-mute-topic" data-stream-id="{{ stream_id }}" data-topic-name="{{ topic_name }}">
<i class="fa fa-bell-slash" aria-hidden="true"></i>
{{t "Mute topic"}}
</a>
</li>
- {{/if}}
-
- {{#if can_unmute_topic}}
+ {{else}}
<li>
<a tabindex="0" class="sidebar-popover-unmute-topic" data-stream-id="{{ stream_id }}" data-topic-name="{{ topic_name }}">
<i class="fa fa-bell" aria-hidden="true"></i>
{{t "Unmute topic"}}
</a>
</li>
- {{/if}}
+ {{/unless}}
{{#if has_starred_messages}}
<li>