refactor: Pass in a sub to subs.toggle_home().

This commit is contained in:
Steve Howell 2017-03-04 11:27:37 -08:00 committed by Tim Abbott
parent 3a93a7310e
commit 32c2dc63f1
2 changed files with 5 additions and 5 deletions

View File

@ -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();
});

View File

@ -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);
};