diff --git a/static/js/notifications.js b/static/js/notifications.js index 1a6f59df88..1b680dbaa0 100644 --- a/static/js/notifications.js +++ b/static/js/notifications.js @@ -730,8 +730,9 @@ export function handle_global_notification_updates(notification_name, setting) { } if (settings_config.stream_notification_settings.includes(notification_name)) { - [, notification_name] = /^enable_stream_(.*)$/.exec(notification_name); - stream_ui_updates.update_notification_setting_checkbox(notification_name); + stream_ui_updates.update_notification_setting_checkbox( + settings_config.specialize_stream_notification_setting[notification_name], + ); } if (notification_name === "notification_sound") { diff --git a/static/js/settings_config.ts b/static/js/settings_config.ts index 581ac45a8d..6f03f3f5db 100644 --- a/static/js/settings_config.ts +++ b/static/js/settings_config.ts @@ -595,6 +595,17 @@ export const generalize_stream_notification_setting: Record< wildcard_mentions_notify: "wildcard_mentions_notify", }; +export const specialize_stream_notification_setting: Record< + keyof StreamNotificationSettings, + keyof StreamSpecificNotificationSettings +> = { + enable_stream_desktop_notifications: "desktop_notifications", + enable_stream_audible_notifications: "audible_notifications", + enable_stream_push_notifications: "push_notifications", + enable_stream_email_notifications: "email_notifications", + wildcard_mentions_notify: "wildcard_mentions_notify", +}; + export const pm_mention_notification_settings: (keyof PmNotificationSettings)[] = [ "enable_desktop_notifications", "enable_sounds",