mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 04:53:36 +00:00
refactor: Pass in a sub to subs.toggle_home().
This commit is contained in:
@@ -861,9 +861,10 @@ exports.register_click_handlers = function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('body').on('click', '.toggle_home', function (e) {
|
$('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();
|
popovers.hide_stream_sidebar_popover();
|
||||||
subs.toggle_home(stream);
|
subs.toggle_home(sub);
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ function stream_home_view_clicked(e) {
|
|||||||
var sub_settings = settings_for_sub(sub);
|
var sub_settings = settings_for_sub(sub);
|
||||||
var notification_checkboxes = sub_settings.find(".sub_notification_setting");
|
var notification_checkboxes = sub_settings.find(".sub_notification_setting");
|
||||||
|
|
||||||
subs.toggle_home(sub.name);
|
subs.toggle_home(sub);
|
||||||
|
|
||||||
if (sub.in_home_view) {
|
if (sub.in_home_view) {
|
||||||
sub_settings.find(".mute-note").addClass("hide-mute-note");
|
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);
|
not_in_home_view_checkbox.prop('checked', !value);
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.toggle_home = function (stream_name) {
|
exports.toggle_home = function (sub) {
|
||||||
var sub = stream_data.get_sub(stream_name);
|
|
||||||
update_in_home_view(sub, ! sub.in_home_view);
|
update_in_home_view(sub, ! sub.in_home_view);
|
||||||
set_stream_property(sub, 'in_home_view', sub.in_home_view);
|
set_stream_property(sub, 'in_home_view', sub.in_home_view);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user