setting: De-duplicate logic for bulk-updating notifications settings.

In the new data model, this duplication was unnecessary.
This commit is contained in:
Tim Abbott 2018-03-07 15:15:24 -08:00
parent 2782a5d8dc
commit 0d29864c6a
1 changed files with 4 additions and 13 deletions

View File

@ -74,19 +74,10 @@ exports.set_up = function () {
$("#" + setting).change(function () {
var setting_data = $(this).prop('checked');
change_notification_setting(setting, setting_data, "#stream-notify-settings-status");
if (setting === 'enable_stream_desktop_notifications') {
maybe_bulk_update_stream_notification_setting($('#' + setting), function () {
stream_edit.set_notification_setting_for_all_streams('desktop_notifications', setting_data);
});
} else if (setting === 'enable_stream_push_notifications') {
maybe_bulk_update_stream_notification_setting($('#' + setting), function () {
stream_edit.set_notification_setting_for_all_streams('push_notifications', setting_data);
});
} else if (setting === 'enable_stream_sounds') {
maybe_bulk_update_stream_notification_setting($('#' + setting), function () {
stream_edit.set_notification_setting_for_all_streams('audible_notifications', setting_data);
});
}
maybe_bulk_update_stream_notification_setting($('#' + setting), function () {
stream_edit.set_notification_setting_for_all_streams(
stream_setting.notifications, setting_data);
});
});
});