settings: Fix live update code of notification settings.

We add code for live updating notification batching period
setting. This commit also adds 'continue' statement in the
else-if condition of update_page function such that we do
not execute the code of checkbox settings for notification
sound and email batching period settings.

We also update the other_notification_settings list in
settings_config.ts to remove email_notifications_batching_period
and instead have email_notifications_batching_period_seconds
which is the correct name of setting used in backend and in
the events sent to the clients such that the live-update is
done correctly.
This commit is contained in:
Sahil Batra
2021-09-16 13:18:27 +05:30
committed by Tim Abbott
parent 90e4740455
commit 44c820da3a
2 changed files with 7 additions and 3 deletions

View File

@@ -478,7 +478,7 @@ const other_notification_settings = desktop_notification_settings.concat(
["desktop_icon_count_display"], ["desktop_icon_count_display"],
mobile_notification_settings, mobile_notification_settings,
email_notification_settings, email_notification_settings,
["email_notifications_batching_period"], ["email_notifications_batching_period_seconds"],
["notification_sound"], ["notification_sound"],
); );

View File

@@ -149,8 +149,12 @@ export function update_page() {
} else if (setting === "desktop_icon_count_display") { } else if (setting === "desktop_icon_count_display") {
update_desktop_icon_count_display(); update_desktop_icon_count_display();
continue; continue;
} else if (setting === "notification_sound") { } else if (
container.find(".setting_notification_sound").val(user_settings.notification_sound); setting === "notification_sound" ||
setting === "email_notifications_batching_period_seconds"
) {
container.find(`.setting_${CSS.escape(setting)}`).val(user_settings[setting]);
continue;
} }
container.find(`.${CSS.escape(setting)}`).prop("checked", user_settings[setting]); container.find(`.${CSS.escape(setting)}`).prop("checked", user_settings[setting]);