settings_config: Add specialize_stream_notification_setting table.

This fixes a bug in commit 513207523c
(#21284) where handle_global_notification_updates would throw an error
on wildcard_mentions_notify because our API isn’t as symmetric as it
should be.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2022-08-25 12:07:07 -07:00 committed by Tim Abbott
parent 5387e56da7
commit d123056000
2 changed files with 14 additions and 2 deletions

View File

@ -730,8 +730,9 @@ export function handle_global_notification_updates(notification_name, setting) {
} }
if (settings_config.stream_notification_settings.includes(notification_name)) { if (settings_config.stream_notification_settings.includes(notification_name)) {
[, notification_name] = /^enable_stream_(.*)$/.exec(notification_name); stream_ui_updates.update_notification_setting_checkbox(
stream_ui_updates.update_notification_setting_checkbox(notification_name); settings_config.specialize_stream_notification_setting[notification_name],
);
} }
if (notification_name === "notification_sound") { if (notification_name === "notification_sound") {

View File

@ -595,6 +595,17 @@ export const generalize_stream_notification_setting: Record<
wildcard_mentions_notify: "wildcard_mentions_notify", 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)[] = [ export const pm_mention_notification_settings: (keyof PmNotificationSettings)[] = [
"enable_desktop_notifications", "enable_desktop_notifications",
"enable_sounds", "enable_sounds",