mirror of https://github.com/zulip/zulip.git
topics_sidebar_actions: Update topics_sidebar to include unmute option.
Updated topics_sidebar_actions.hbs to include a option to add/remove unmute visibility_policy for a topic is in a muted stream, if in development environment. Added 2 new classes sidebar-popover-unmute-topic and sidebar-popover-remove-unmute for unmute topic option. Also, Renamed previous sidebar-popover-unmute-topic to sidebar-popover-remove-mute. Added 4 new click handlersthat uses user_topics.set_user_topic_visibility_policy() to update topic's visibility_policy. Fixes #24244
This commit is contained in:
parent
aab252f657
commit
7105a232aa
|
@ -30,7 +30,6 @@ import {$t, $t_html} from "./i18n";
|
||||||
import * as message_edit from "./message_edit";
|
import * as message_edit from "./message_edit";
|
||||||
import * as message_edit_history from "./message_edit_history";
|
import * as message_edit_history from "./message_edit_history";
|
||||||
import * as message_lists from "./message_lists";
|
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 narrow_state from "./narrow_state";
|
||||||
import * as popover_menus_data from "./popover_menus_data";
|
import * as popover_menus_data from "./popover_menus_data";
|
||||||
import * as popovers from "./popovers";
|
import * as popovers from "./popovers";
|
||||||
|
@ -43,6 +42,7 @@ import * as stream_popover from "./stream_popover";
|
||||||
import {parse_html} from "./ui_util";
|
import {parse_html} from "./ui_util";
|
||||||
import * as unread_ops from "./unread_ops";
|
import * as unread_ops from "./unread_ops";
|
||||||
import {user_settings} from "./user_settings";
|
import {user_settings} from "./user_settings";
|
||||||
|
import * as user_topics from "./user_topics";
|
||||||
|
|
||||||
let message_actions_popover_keyboard_toggle = false;
|
let message_actions_popover_keyboard_toggle = false;
|
||||||
|
|
||||||
|
@ -307,13 +307,39 @@ export function initialize() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$popper.one("click", ".sidebar-popover-mute-topic", () => {
|
$popper.one("click", ".sidebar-popover-unmute-topic", () => {
|
||||||
muted_topics_ui.mute_topic(stream_id, topic_name);
|
user_topics.set_user_topic_visibility_policy(
|
||||||
|
stream_id,
|
||||||
|
topic_name,
|
||||||
|
user_topics.all_visibility_policies.UNMUTED,
|
||||||
|
);
|
||||||
instance.hide();
|
instance.hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
$popper.one("click", ".sidebar-popover-unmute-topic", () => {
|
$popper.one("click", ".sidebar-popover-remove-unmute", () => {
|
||||||
muted_topics_ui.unmute_topic(stream_id, topic_name);
|
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();
|
instance.hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -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}) {
|
export function get_topic_popover_content_context({stream_id, topic_name, url}) {
|
||||||
const sub = sub_store.get(stream_id);
|
const sub = sub_store.get(stream_id);
|
||||||
const topic_muted = user_topics.is_topic_muted(sub.stream_id, topic_name);
|
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 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();
|
const can_move_topic = settings_data.user_can_move_messages_between_streams();
|
||||||
return {
|
return {
|
||||||
stream_name: sub.name,
|
stream_name: sub.name,
|
||||||
stream_id: sub.stream_id,
|
stream_id: sub.stream_id,
|
||||||
|
stream_muted: sub.is_muted,
|
||||||
topic_name,
|
topic_name,
|
||||||
topic_muted,
|
topic_muted,
|
||||||
|
topic_unmuted,
|
||||||
|
development_environment: page_params.development_environment,
|
||||||
can_move_topic,
|
can_move_topic,
|
||||||
is_realm_admin: page_params.is_admin,
|
is_realm_admin: page_params.is_admin,
|
||||||
topic_is_resolved: resolved_topic.is_resolved(topic_name),
|
topic_is_resolved: resolved_topic.is_resolved(topic_name),
|
||||||
|
|
|
@ -8,6 +8,26 @@
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
|
{{#if development_environment}}
|
||||||
|
{{#if stream_muted}}
|
||||||
|
{{#unless topic_unmuted}}
|
||||||
|
<li class="hidden-for-spectators">
|
||||||
|
<a tabindex="0" class="sidebar-popover-unmute-topic" data-stream-id="{{ stream_id }}" data-topic-name="{{ topic_name }}">
|
||||||
|
<i class="zulip-icon zulip-icon-mute" aria-hidden="true"></i>
|
||||||
|
{{t "Unmute topic (muted stream)"}}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{{else}}
|
||||||
|
<li class="hidden-for-spectators">
|
||||||
|
<a tabindex="0" class="sidebar-popover-remove-unmute" data-stream-id="{{ stream_id }}" data-topic-name="{{ topic_name }}">
|
||||||
|
<i class="zulip-icon zulip-icon-mute" aria-hidden="true"></i>
|
||||||
|
{{t "Mute topic (muted stream)"}}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{{/unless}}
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{#unless topic_muted}}
|
{{#unless topic_muted}}
|
||||||
<li class="hidden-for-spectators">
|
<li class="hidden-for-spectators">
|
||||||
<a tabindex="0" class="sidebar-popover-mute-topic" data-stream-id="{{ stream_id }}" data-topic-name="{{ topic_name }}">
|
<a tabindex="0" class="sidebar-popover-mute-topic" data-stream-id="{{ stream_id }}" data-topic-name="{{ topic_name }}">
|
||||||
|
@ -17,7 +37,7 @@
|
||||||
</li>
|
</li>
|
||||||
{{else}}
|
{{else}}
|
||||||
<li class="hidden-for-spectators">
|
<li class="hidden-for-spectators">
|
||||||
<a tabindex="0" class="sidebar-popover-unmute-topic" data-stream-id="{{ stream_id }}" data-topic-name="{{ topic_name }}">
|
<a tabindex="0" class="sidebar-popover-remove-mute" data-stream-id="{{ stream_id }}" data-topic-name="{{ topic_name }}">
|
||||||
<i class="zulip-icon zulip-icon-mute" aria-hidden="true"></i>
|
<i class="zulip-icon zulip-icon-mute" aria-hidden="true"></i>
|
||||||
{{t "Unmute topic"}}
|
{{t "Unmute topic"}}
|
||||||
</a>
|
</a>
|
||||||
|
|
Loading…
Reference in New Issue