mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
Add muting to message actions menu
(imported from commit 26568e36f2a41f2b85413ab4d069a689c9901aac)
This commit is contained in:
@@ -30,6 +30,8 @@ exports.fade_users_when_composing = page_params.staging;
|
||||
exports.alert_words = page_params.staging ||
|
||||
_.contains(['reddit.com'], page_params.domain);
|
||||
|
||||
exports.muting = page_params.staging;
|
||||
|
||||
return exports;
|
||||
|
||||
}());
|
||||
|
||||
@@ -55,9 +55,16 @@ exports.show_actions_popover = function (element, id) {
|
||||
if (elt.data('popover') === undefined) {
|
||||
var message = current_msg_list.get(id);
|
||||
var can_edit = message.sent_by_me;
|
||||
var can_mute_topic =
|
||||
feature_flags.muting &&
|
||||
message.stream &&
|
||||
message.subject &&
|
||||
!muting.is_topic_muted(message.stream, message.subject);
|
||||
|
||||
var args = {
|
||||
message: message,
|
||||
can_edit_message: can_edit,
|
||||
can_mute_topic: can_mute_topic,
|
||||
narrowed: narrow.active()
|
||||
};
|
||||
|
||||
@@ -366,6 +373,16 @@ exports.register_click_handlers = function () {
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
$('body').on('click', '.popover_mute_topic', function (e) {
|
||||
var stream = $(e.currentTarget).data('msg-stream');
|
||||
var topic = $(e.currentTarget).data('msg-topic');
|
||||
popovers.hide_actions_popover();
|
||||
muting.mute_topic(stream, topic);
|
||||
current_msg_list.rerender();
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
$('body').on('click', '.toggle_home', function (e) {
|
||||
var stream = $(e.currentTarget).parents('ul').attr('data-name');
|
||||
popovers.hide_stream_sidebar_popover();
|
||||
|
||||
@@ -57,4 +57,13 @@
|
||||
</a>
|
||||
</li>
|
||||
|
||||
{{#if can_mute_topic}}
|
||||
<li>
|
||||
<a href="#" class="popover_mute_topic" data-msg-stream="{{message.stream}}" data-msg-topic="{{message.subject}}">
|
||||
<i class="icon-vector-eye-close"></i>
|
||||
Mute the topic <b>{{message.subject}}</b>
|
||||
</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user