diff --git a/static/js/stream_list.js b/static/js/stream_list.js index b914be8858..bc444e67fc 100644 --- a/static/js/stream_list.js +++ b/static/js/stream_list.js @@ -396,6 +396,39 @@ $(function () { // We need to make sure we resort if the removed sub gets added again previous_sort_order = undefined; }); + + $('#stream_filters').on('click', 'li .subscription_block', function (e) { + if (e.metaKey || e.ctrlKey) { + return; + } + if (ui.home_tab_obscured()) { + ui.change_tab_to('#home'); + } + var stream = $(e.target).parents('li').attr('data-name'); + narrow.by('stream', stream, {select_first_unread: true, trigger: 'sidebar'}); + + e.preventDefault(); + e.stopPropagation(); + }); + + $('#stream_filters').on('click', '.subject_box', function (e) { + if (e.metaKey || e.ctrlKey) { + return; + } + if (ui.home_tab_obscured()) { + ui.change_tab_to('#home'); + } + + var stream = $(e.target).parents('ul').attr('data-stream'); + var subject = $(e.target).parents('li').attr('data-name'); + + narrow.activate([['stream', stream], + ['topic', subject]], + {select_first_unread: true, trigger: 'sidebar'}); + + e.preventDefault(); + }); + }); return exports; diff --git a/static/js/ui.js b/static/js/ui.js index 65e28e41f3..03f63be26a 100644 --- a/static/js/ui.js +++ b/static/js/ui.js @@ -1380,41 +1380,9 @@ $(function () { e.preventDefault(); }); - $('#stream_filters').on('click', 'li .subscription_block', function (e) { - if (e.metaKey || e.ctrlKey) { - return; - } - if (exports.home_tab_obscured()) { - ui.change_tab_to('#home'); - } - var stream = $(e.target).parents('li').attr('data-name'); - narrow.by('stream', stream, {select_first_unread: true, trigger: 'sidebar'}); - - e.preventDefault(); - e.stopPropagation(); - }); - popovers.register_click_handlers(); notifications.register_click_handlers(); - $('#stream_filters').on('click', '.subject_box', function (e) { - if (e.metaKey || e.ctrlKey) { - return; - } - if (exports.home_tab_obscured()) { - ui.change_tab_to('#home'); - } - - var stream = $(e.target).parents('ul').attr('data-stream'); - var subject = $(e.target).parents('li').attr('data-name'); - - narrow.activate([['stream', stream], - ['topic', subject]], - {select_first_unread: true, trigger: 'sidebar'}); - - e.preventDefault(); - }); - $('.compose_stream_button').click(function (e) { compose.start('stream'); });