mirror of https://github.com/zulip/zulip.git
settings_config: Add generalize_stream_notification_setting table.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
77599d4db1
commit
5387e56da7
|
@ -584,6 +584,17 @@ export const stream_notification_settings: (keyof StreamNotificationSettings)[]
|
|||
"wildcard_mentions_notify",
|
||||
];
|
||||
|
||||
export const generalize_stream_notification_setting: Record<
|
||||
keyof StreamSpecificNotificationSettings,
|
||||
keyof StreamNotificationSettings
|
||||
> = {
|
||||
desktop_notifications: "enable_stream_desktop_notifications",
|
||||
audible_notifications: "enable_stream_audible_notifications",
|
||||
push_notifications: "enable_stream_push_notifications",
|
||||
email_notifications: "enable_stream_email_notifications",
|
||||
wildcard_mentions_notify: "wildcard_mentions_notify",
|
||||
};
|
||||
|
||||
export const pm_mention_notification_settings: (keyof PmNotificationSettings)[] = [
|
||||
"enable_desktop_notifications",
|
||||
"enable_sounds",
|
||||
|
|
|
@ -468,10 +468,7 @@ export function receives_notifications(stream_id, notification_name) {
|
|||
if (sub[notification_name] !== null) {
|
||||
return sub[notification_name];
|
||||
}
|
||||
if (notification_name === "wildcard_mentions_notify") {
|
||||
return user_settings[notification_name];
|
||||
}
|
||||
return user_settings["enable_stream_" + notification_name];
|
||||
return user_settings[settings_config.generalize_stream_notification_setting[notification_name]];
|
||||
}
|
||||
|
||||
export function all_subscribed_streams_are_in_home_view() {
|
||||
|
|
|
@ -330,11 +330,8 @@ export function stream_setting_changed(e, from_notification_settings) {
|
|||
return;
|
||||
}
|
||||
if (is_notification_setting(setting) && sub[setting] === null) {
|
||||
if (setting === "wildcard_mentions_notify") {
|
||||
sub[setting] = user_settings[setting];
|
||||
} else {
|
||||
sub[setting] = user_settings["enable_stream_" + setting];
|
||||
}
|
||||
sub[setting] =
|
||||
user_settings[settings_config.generalize_stream_notification_setting[setting]];
|
||||
}
|
||||
set_stream_property(sub, setting, e.target.checked, status_element);
|
||||
}
|
||||
|
|
|
@ -60,9 +60,10 @@ export function get_unmatched_streams_for_notification_settings() {
|
|||
const settings_values = {};
|
||||
let make_table_row = false;
|
||||
for (const notification_name of settings_config.stream_specific_notification_settings) {
|
||||
const prepend =
|
||||
notification_name === "wildcard_mentions_notify" ? "" : "enable_stream_";
|
||||
const default_setting = user_settings[prepend + notification_name];
|
||||
const default_setting =
|
||||
user_settings[
|
||||
settings_config.generalize_stream_notification_setting[notification_name]
|
||||
];
|
||||
const stream_setting = stream_data.receives_notifications(
|
||||
row.stream_id,
|
||||
notification_name,
|
||||
|
|
Loading…
Reference in New Issue