Extract settings_muting.js.

This commit is contained in:
Steve Howell 2017-04-06 07:56:52 -07:00 committed by Tim Abbott
parent 1f38884b27
commit 89128a2272
5 changed files with 29 additions and 14 deletions

View File

@ -35,6 +35,7 @@
"settings_account": false, "settings_account": false,
"settings_display": false, "settings_display": false,
"settings_notifications": false, "settings_notifications": false,
"settings_muting": false,
"settings": false, "settings": false,
"resize": false, "resize": false,
"loading": false, "loading": false,

View File

@ -245,6 +245,7 @@ function _setup_page() {
settings_account.set_up(); settings_account.set_up();
settings_display.set_up(); settings_display.set_up();
settings_notifications.set_up(); settings_notifications.set_up();
settings_muting.set_up();
$("#api_key_value").text(""); $("#api_key_value").text("");
$("#get_api_key_box").hide(); $("#get_api_key_box").hide();
@ -574,19 +575,6 @@ function _setup_page() {
}); });
}); });
$(function () {
$('body').on('click', '.settings-unmute-topic', function (e) {
var $row = $(this).closest("tr");
var stream = $row.data("stream");
var topic = $row.data("topic");
muting_ui.unmute(stream, topic);
$row.remove();
e.stopImmediatePropagation();
});
muting_ui.set_up_muted_topics_ui(muting.get_muted_topics());
});
} }
exports.setup_page = function () { exports.setup_page = function () {

View File

@ -0,0 +1,24 @@
var settings_muting = (function () {
var exports = {};
exports.set_up = function () {
$('body').on('click', '.settings-unmute-topic', function (e) {
var $row = $(this).closest("tr");
var stream = $row.data("stream");
var topic = $row.data("topic");
muting_ui.unmute(stream, topic);
$row.remove();
e.stopImmediatePropagation();
});
muting_ui.set_up_muted_topics_ui(muting.get_muted_topics());
};
return exports;
}());
if (typeof module !== 'undefined') {
module.exports = settings_muting;
}

View File

@ -91,6 +91,7 @@ def find_edges_to_remove(graph, methods):
('hashchange', 'drafts'), ('hashchange', 'drafts'),
('compose', 'echo'), ('compose', 'echo'),
('compose', 'resize'), ('compose', 'resize'),
('settings', 'resize'),
('compose', 'unread_ops'), ('compose', 'unread_ops'),
('compose', 'drafts'), ('compose', 'drafts'),
('echo', 'message_edit'), ('echo', 'message_edit'),
@ -160,7 +161,7 @@ def find_edges_to_remove(graph, methods):
('message_edit', 'compose'), ('message_edit', 'compose'),
('message_store', 'compose'), ('message_store', 'compose'),
('settings_notifications', 'subs'), ('settings_notifications', 'subs'),
('settings', 'muting_ui'), ('settings', 'settings_muting'),
('message_fetch', 'tutorial'), ('message_fetch', 'tutorial'),
('settings', 'subs'), ('settings', 'subs'),
('activity', 'narrow'), ('activity', 'narrow'),

View File

@ -908,6 +908,7 @@ JS_SPECS = {
'js/settings_account.js', 'js/settings_account.js',
'js/settings_display.js', 'js/settings_display.js',
'js/settings_notifications.js', 'js/settings_notifications.js',
'js/settings_muting.js',
'js/settings.js', 'js/settings.js',
'js/admin.js', 'js/admin.js',
'js/tab_bar.js', 'js/tab_bar.js',