mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 14:35:27 +00:00
Persist muting preferences to the back end
(imported from commit db2d4362a0601f35a75b798cf6945556e44532fb)
This commit is contained in:
24
static/js/muting_ui.js
Normal file
24
static/js/muting_ui.js
Normal file
@@ -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');
|
var topic = $(e.currentTarget).data('msg-topic');
|
||||||
popovers.hide_actions_popover();
|
popovers.hide_actions_popover();
|
||||||
muting.mute_topic(stream, topic);
|
muting.mute_topic(stream, topic);
|
||||||
current_msg_list.rerender();
|
muting_ui.persist_and_rerender();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
@@ -395,7 +395,7 @@ exports.register_click_handlers = function () {
|
|||||||
var topic = $(e.currentTarget).data('msg-topic');
|
var topic = $(e.currentTarget).data('msg-topic');
|
||||||
popovers.hide_actions_popover();
|
popovers.hide_actions_popover();
|
||||||
muting.unmute_topic(stream, topic);
|
muting.unmute_topic(stream, topic);
|
||||||
current_msg_list.rerender();
|
muting_ui.persist_and_rerender();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ var globals =
|
|||||||
+ ' invite ui util activity timerender MessageList MessageListView blueslip unread stream_list'
|
+ ' invite ui util activity timerender MessageList MessageListView blueslip unread stream_list'
|
||||||
+ ' onboarding message_edit tab_bar emoji popovers navigate message_tour'
|
+ ' onboarding message_edit tab_bar emoji popovers navigate message_tour'
|
||||||
+ ' avatar feature_flags search_suggestion referral stream_color Dict'
|
+ ' 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.js
|
||||||
+ ' colorspace'
|
+ ' colorspace'
|
||||||
|
|||||||
@@ -368,6 +368,7 @@ JS_SPECS = {
|
|||||||
'js/util.js',
|
'js/util.js',
|
||||||
'js/dict.js',
|
'js/dict.js',
|
||||||
'js/muting.js',
|
'js/muting.js',
|
||||||
|
'js/muting_ui.js',
|
||||||
'js/setup.js',
|
'js/setup.js',
|
||||||
'js/viewport.js',
|
'js/viewport.js',
|
||||||
'js/rows.js',
|
'js/rows.js',
|
||||||
|
|||||||
Reference in New Issue
Block a user