muting: Use stream_id in markup for action menus.

This commit is contained in:
Steve Howell
2018-12-14 16:59:21 +00:00
committed by Tim Abbott
parent d75ff80eb2
commit f18ce4f923
2 changed files with 6 additions and 19 deletions

View File

@@ -898,15 +898,8 @@ exports.register_click_handlers = function () {
}); });
$('body').on('click', '.popover_mute_topic', function (e) { $('body').on('click', '.popover_mute_topic', function (e) {
var stream = $(e.currentTarget).data('msg-stream'); var stream_id = $(e.currentTarget).attr('data-msg-stream-id');
var topic = $(e.currentTarget).data('msg-topic'); var topic = $(e.currentTarget).attr('data-msg-topic');
// TODO: use stream_id in markup
var stream_id = stream_data.get_stream_id(stream);
if (!stream_id) {
return;
}
popovers.hide_actions_popover(); popovers.hide_actions_popover();
muting_ui.mute(stream_id, topic); muting_ui.mute(stream_id, topic);
@@ -915,14 +908,8 @@ exports.register_click_handlers = function () {
}); });
$('body').on('click', '.popover_unmute_topic', function (e) { $('body').on('click', '.popover_unmute_topic', function (e) {
var stream = $(e.currentTarget).data('msg-stream'); var stream_id = $(e.currentTarget).attr('data-msg-stream-id');
var topic = $(e.currentTarget).data('msg-topic'); var topic = $(e.currentTarget).attr('data-msg-topic');
var stream_id = stream_data.get_stream_id(stream);
if (!stream_id) {
return;
}
popovers.hide_actions_popover(); popovers.hide_actions_popover();
muting_ui.unmute(stream_id, topic); muting_ui.unmute(stream_id, topic);

View File

@@ -61,7 +61,7 @@
{{/if}} {{/if}}
{{#if can_mute_topic}} {{#if can_mute_topic}}
<li> <li>
<a href="#" class="popover_mute_topic" data-msg-stream="{{message.stream}}" data-msg-topic="{{message.subject}}"> <a href="#" class="popover_mute_topic" data-msg-stream-id="{{message.stream_id}}" data-msg-topic="{{message.subject}}">
<i class="fa fa-eye-slash" aria-hidden="true"></i> <i class="fa fa-eye-slash" aria-hidden="true"></i>
{{#tr message}}Mute the topic <b>__subject__</b>{{/tr}} <span class="hotkey-hint">(M)</span> {{#tr message}}Mute the topic <b>__subject__</b>{{/tr}} <span class="hotkey-hint">(M)</span>
</a> </a>
@@ -70,7 +70,7 @@
{{#if can_unmute_topic}} {{#if can_unmute_topic}}
<li> <li>
<a href="#" class="popover_unmute_topic" data-msg-stream="{{message.stream}}" data-msg-topic="{{message.subject}}"> <a href="#" class="popover_unmute_topic" data-msg-stream-id="{{message.stream_id}}" data-msg-topic="{{message.subject}}">
<i class="fa fa-eye" aria-hidden="true"></i> <i class="fa fa-eye" aria-hidden="true"></i>
{{#tr message}}Unmute the topic <b>__subject__</b>{{/tr}} {{#tr message}}Unmute the topic <b>__subject__</b>{{/tr}}
</a> </a>