diff --git a/static/js/popovers.js b/static/js/popovers.js index 7985f04bf6..28eab55df2 100644 --- a/static/js/popovers.js +++ b/static/js/popovers.js @@ -861,9 +861,10 @@ exports.register_click_handlers = function () { }); $('body').on('click', '.toggle_home', function (e) { - var stream = $(e.currentTarget).parents('ul').attr('data-name'); + var stream_name = $(e.currentTarget).parents('ul').attr('data-name'); + var sub = stream_data.get_sub(stream_name); popovers.hide_stream_sidebar_popover(); - subs.toggle_home(stream); + subs.toggle_home(sub); e.stopPropagation(); }); diff --git a/static/js/subs.js b/static/js/subs.js index 9915b9d94a..3f797d07f0 100644 --- a/static/js/subs.js +++ b/static/js/subs.js @@ -121,7 +121,7 @@ function stream_home_view_clicked(e) { var sub_settings = settings_for_sub(sub); var notification_checkboxes = sub_settings.find(".sub_notification_setting"); - subs.toggle_home(sub.name); + subs.toggle_home(sub); if (sub.in_home_view) { sub_settings.find(".mute-note").addClass("hide-mute-note"); @@ -184,8 +184,7 @@ function update_in_home_view(sub, value) { not_in_home_view_checkbox.prop('checked', !value); } -exports.toggle_home = function (stream_name) { - var sub = stream_data.get_sub(stream_name); +exports.toggle_home = function (sub) { update_in_home_view(sub, ! sub.in_home_view); set_stream_property(sub, 'in_home_view', sub.in_home_view); };