diff --git a/.eslintrc.json b/.eslintrc.json index cee41ce181..b828054f5c 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -35,6 +35,7 @@ "settings_account": false, "settings_display": false, "settings_notifications": false, + "settings_muting": false, "settings": false, "resize": false, "loading": false, diff --git a/static/js/settings.js b/static/js/settings.js index 467a23d760..d540534c84 100644 --- a/static/js/settings.js +++ b/static/js/settings.js @@ -245,6 +245,7 @@ function _setup_page() { settings_account.set_up(); settings_display.set_up(); settings_notifications.set_up(); + settings_muting.set_up(); $("#api_key_value").text(""); $("#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 () { diff --git a/static/js/settings_muting.js b/static/js/settings_muting.js new file mode 100644 index 0000000000..ba3e0e8e22 --- /dev/null +++ b/static/js/settings_muting.js @@ -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; +} diff --git a/tools/js-dep-visualizer.py b/tools/js-dep-visualizer.py index 27e50361cb..f7f805cd56 100644 --- a/tools/js-dep-visualizer.py +++ b/tools/js-dep-visualizer.py @@ -91,6 +91,7 @@ def find_edges_to_remove(graph, methods): ('hashchange', 'drafts'), ('compose', 'echo'), ('compose', 'resize'), + ('settings', 'resize'), ('compose', 'unread_ops'), ('compose', 'drafts'), ('echo', 'message_edit'), @@ -160,7 +161,7 @@ def find_edges_to_remove(graph, methods): ('message_edit', 'compose'), ('message_store', 'compose'), ('settings_notifications', 'subs'), - ('settings', 'muting_ui'), + ('settings', 'settings_muting'), ('message_fetch', 'tutorial'), ('settings', 'subs'), ('activity', 'narrow'), diff --git a/zproject/settings.py b/zproject/settings.py index 65915b789f..6f3ad54f9a 100644 --- a/zproject/settings.py +++ b/zproject/settings.py @@ -908,6 +908,7 @@ JS_SPECS = { 'js/settings_account.js', 'js/settings_display.js', 'js/settings_notifications.js', + 'js/settings_muting.js', 'js/settings.js', 'js/admin.js', 'js/tab_bar.js',