mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 06:53:25 +00:00
stream_settings: Move "Mute stream" to the top of Notification settings.
In this commit, we move the "Mute stream" option to the top of the notification settings, since the action of muting a stream works in conjunction with the other notification settings. We also rename `is_notification_setting` to `has_global_notification_setting` which better defines the purpose of the function and now use `is_notification_setting` only to check which options we need to show under the "Notification settings" section. This allows us to accommodate the "Mute stream" option under the "Notification settings" section without affecting the functionality of the other notification options. Fixes part of #27274.
This commit is contained in:
@@ -151,7 +151,7 @@ function show_subscription_settings(sub) {
|
||||
});
|
||||
}
|
||||
|
||||
function is_notification_setting(setting_label) {
|
||||
function has_global_notification_setting(setting_label) {
|
||||
if (setting_label.includes("_notifications")) {
|
||||
return true;
|
||||
} else if (setting_label.includes("_notify")) {
|
||||
@@ -160,6 +160,10 @@ function is_notification_setting(setting_label) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function is_notification_setting(setting_label) {
|
||||
return has_global_notification_setting(setting_label) || setting_label === "is_muted";
|
||||
}
|
||||
|
||||
export function stream_settings(sub) {
|
||||
const settings_labels = settings_config.general_notifications_table_labels.stream;
|
||||
const check_realm_setting =
|
||||
@@ -171,9 +175,9 @@ export function stream_settings(sub) {
|
||||
label: settings_labels[setting],
|
||||
disabled_realm_setting: check_realm_setting[setting],
|
||||
is_disabled: check_realm_setting[setting],
|
||||
is_notification_setting: is_notification_setting(setting),
|
||||
has_global_notification_setting: has_global_notification_setting(setting),
|
||||
};
|
||||
if (is_notification_setting(setting)) {
|
||||
if (has_global_notification_setting(setting)) {
|
||||
// This block ensures we correctly display to users the
|
||||
// current state of stream-level notification settings
|
||||
// with a value of `null`, which inherit the user's global
|
||||
@@ -233,7 +237,7 @@ export function show_settings_for(node) {
|
||||
|
||||
const other_settings = [];
|
||||
const notification_settings = all_settings.filter((setting) => {
|
||||
if (setting.is_notification_setting) {
|
||||
if (is_notification_setting(setting.name)) {
|
||||
return true;
|
||||
}
|
||||
other_settings.push(setting);
|
||||
@@ -313,7 +317,7 @@ function stream_setting_changed(e) {
|
||||
blueslip.error("undefined sub in stream_setting_changed()");
|
||||
return;
|
||||
}
|
||||
if (is_notification_setting(setting) && sub[setting] === null) {
|
||||
if (has_global_notification_setting(setting) && sub[setting] === null) {
|
||||
sub[setting] =
|
||||
user_settings[settings_config.generalize_stream_notification_setting[setting]];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user