compose: Add banner for unmuting the muted topic a message is sent to.

We add a new banner informing the user if and when they send a message
to a muted topic / stream. It also has a button to unmute the topic.

Fixes: #24246.
This commit is contained in:
N-Shar-ma
2023-04-13 22:10:17 +05:30
committed by Tim Abbott
parent ff8d209807
commit 9f2ef69c71
9 changed files with 111 additions and 16 deletions

View File

@@ -39,6 +39,7 @@ import * as transmit from "./transmit";
import * as ui_report from "./ui_report";
import * as upload from "./upload";
import {user_settings} from "./user_settings";
import * as user_topics from "./user_topics";
import * as util from "./util";
import * as zcommand from "./zcommand";
@@ -515,6 +516,28 @@ export function initialize() {
},
);
$("#compose_banners").on(
"click",
`.${CSS.escape(
compose_banner.CLASSNAMES.unmute_topic_notification,
)} .compose_banner_action_button`,
(event) => {
event.preventDefault();
const $target = $(event.target).parents(".compose_banner");
const stream_id = Number.parseInt($target.attr("data-stream-id"), 10);
const topic_name = $target.attr("data-topic-name");
user_topics.set_user_topic_visibility_policy(
stream_id,
topic_name,
user_topics.all_visibility_policies.UNMUTED,
false,
true,
);
},
);
$("#compose_banners").on(
"click",
`.${CSS.escape(