settings: Convert general_notifications_table_labels.stream to tuples.

This will help with the typescript conversion.
This commit is contained in:
evykassirer 2024-10-30 14:23:41 -07:00 committed by Tim Abbott
parent 792e9fa047
commit e50a51a8e1
2 changed files with 14 additions and 12 deletions

View File

@ -647,15 +647,18 @@ export const general_notifications_table_labels = {
"email", "email",
"all_mentions", "all_mentions",
], ],
stream: { stream: [
is_muted: $t({defaultMessage: "Mute channel"}), ["is_muted", $t({defaultMessage: "Mute channel"})],
desktop_notifications: $t({defaultMessage: "Visual desktop notifications"}), ["desktop_notifications", $t({defaultMessage: "Visual desktop notifications"})],
audible_notifications: $t({defaultMessage: "Audible desktop notifications"}), ["audible_notifications", $t({defaultMessage: "Audible desktop notifications"})],
push_notifications: $t({defaultMessage: "Mobile notifications"}), ["push_notifications", $t({defaultMessage: "Mobile notifications"})],
email_notifications: $t({defaultMessage: "Email notifications"}), ["email_notifications", $t({defaultMessage: "Email notifications"})],
pin_to_top: $t({defaultMessage: "Pin channel to top of left sidebar"}), ["pin_to_top", $t({defaultMessage: "Pin channel to top of left sidebar"})],
wildcard_mentions_notify: $t({defaultMessage: "Notifications for @all/@everyone mentions"}), [
}, "wildcard_mentions_notify",
$t({defaultMessage: "Notifications for @all/@everyone mentions"}),
],
] as const,
}; };
export const stream_specific_notification_settings: (keyof StreamSpecificNotificationSettings)[] = [ export const stream_specific_notification_settings: (keyof StreamSpecificNotificationSettings)[] = [

View File

@ -185,10 +185,10 @@ export function stream_settings(sub) {
const check_realm_setting = const check_realm_setting =
settings_config.all_notifications(user_settings).disabled_notification_settings; settings_config.all_notifications(user_settings).disabled_notification_settings;
const settings = Object.keys(settings_labels).map((setting) => { return settings_labels.map(([setting, label]) => {
const ret = { const ret = {
name: setting, name: setting,
label: settings_labels[setting], label,
disabled_realm_setting: check_realm_setting[setting], disabled_realm_setting: check_realm_setting[setting],
is_disabled: check_realm_setting[setting], is_disabled: check_realm_setting[setting],
has_global_notification_setting: has_global_notification_setting(setting), has_global_notification_setting: has_global_notification_setting(setting),
@ -206,7 +206,6 @@ export function stream_settings(sub) {
ret.is_checked = sub[setting] && !check_realm_setting[setting]; ret.is_checked = sub[setting] && !check_realm_setting[setting];
return ret; return ret;
}); });
return settings;
} }
function setup_dropdown(sub, slim_sub) { function setup_dropdown(sub, slim_sub) {