mirror of https://github.com/zulip/zulip.git
Persist muting preferences to the back end
(imported from commit db2d4362a0601f35a75b798cf6945556e44532fb)
This commit is contained in:
parent
b7ef86bc34
commit
b4b6fa14d3
|
@ -0,0 +1,24 @@
|
|||
var muting_ui = (function () {
|
||||
|
||||
var exports = {};
|
||||
|
||||
exports.persist_and_rerender = function () {
|
||||
// Optimistically rerender our new muting preferences. The back
|
||||
// end should eventually save it, and if it doesn't, it's a recoverable
|
||||
// error--the user can just mute the topic again, and the topic might
|
||||
// die down before the next reload anyway, making the muting moot.
|
||||
current_msg_list.rerender();
|
||||
var data = {
|
||||
muted_topics: JSON.stringify(muting.get_muted_topics())
|
||||
};
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/json/set_muted_topics',
|
||||
data: data,
|
||||
dataType: 'json'
|
||||
});
|
||||
};
|
||||
|
||||
return exports;
|
||||
}());
|
||||
|
|
@ -385,7 +385,7 @@ exports.register_click_handlers = function () {
|
|||
var topic = $(e.currentTarget).data('msg-topic');
|
||||
popovers.hide_actions_popover();
|
||||
muting.mute_topic(stream, topic);
|
||||
current_msg_list.rerender();
|
||||
muting_ui.persist_and_rerender();
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
});
|
||||
|
@ -395,7 +395,7 @@ exports.register_click_handlers = function () {
|
|||
var topic = $(e.currentTarget).data('msg-topic');
|
||||
popovers.hide_actions_popover();
|
||||
muting.unmute_topic(stream, topic);
|
||||
current_msg_list.rerender();
|
||||
muting_ui.persist_and_rerender();
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
});
|
||||
|
|
|
@ -27,7 +27,7 @@ var globals =
|
|||
+ ' invite ui util activity timerender MessageList MessageListView blueslip unread stream_list'
|
||||
+ ' onboarding message_edit tab_bar emoji popovers navigate message_tour'
|
||||
+ ' avatar feature_flags search_suggestion referral stream_color Dict'
|
||||
+ ' Filter summary admin stream_data muting WinChan'
|
||||
+ ' Filter summary admin stream_data muting WinChan muting_ui'
|
||||
|
||||
// colorspace.js
|
||||
+ ' colorspace'
|
||||
|
|
|
@ -368,6 +368,7 @@ JS_SPECS = {
|
|||
'js/util.js',
|
||||
'js/dict.js',
|
||||
'js/muting.js',
|
||||
'js/muting_ui.js',
|
||||
'js/setup.js',
|
||||
'js/viewport.js',
|
||||
'js/rows.js',
|
||||
|
|
Loading…
Reference in New Issue