Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

settings: Show saved indicator after resetting user settings to default.

Sahil Batraacee2370348b
diff --git a/web/src/settings_preferences.ts b/web/src/settings_preferences.ts
index 0128f74c80a..310a7c91b83 100644
--- a/web/src/settings_preferences.ts
+++ b/web/src/settings_preferences.ts
@@ -389,7 +389,7 @@ function language_select_callback(
const data = {default_language: current_value};
change_display_setting(
data,
- $("#settings_content").find(".general-settings-status"),
+ $("#user-preferences").find(".general-settings-status"),
undefined,
undefined,
$t_html(
diff --git a/web/src/settings_realm_user_settings_defaults.ts b/web/src/settings_realm_user_settings_defaults.ts
index e04f4fad92f..5eea7818cbe 100644
--- a/web/src/settings_realm_user_settings_defaults.ts
+++ b/web/src/settings_realm_user_settings_defaults.ts
@@ -21,6 +21,7 @@ import * as settings_notifications from "./settings_notifications.ts";
import * as settings_org from "./settings_org.ts";
import * as settings_preferences from "./settings_preferences.ts";
import type {SettingsPanel} from "./settings_preferences.ts";
+import * as settings_ui from "./settings_ui.ts";
import {current_user} from "./state_data.ts";
import type {HTMLSelectOneElement} from "./types.ts";
import * as ui_report from "./ui_report.ts";
@@ -85,7 +86,10 @@ function get_realm_default_setting_value_for_reset(property: string): number | s
];
}
-function confirm_resetting_user_setting_to_default(property_list: string[]): void {
+function confirm_resetting_user_setting_to_default(
+ property_list: string[],
+ $status_element: JQuery,
+): void {
const html_body = render_confirm_reset_user_configuration();
function reset_user_configuration(): void {
@@ -106,6 +110,8 @@ function confirm_resetting_user_setting_to_default(property_list: string[]): voi
data,
success() {
dialog_widget.close();
+ ui_report.success($t_html({defaultMessage: "Saved"}), $status_element, 1500);
+ settings_ui.display_checkmark($status_element);
},
error(xhr) {
ui_report.error($t_html({defaultMessage: "Failed"}), xhr, $("#dialog_error"));
@@ -204,7 +210,10 @@ export function set_up(): void {
const $elem = $(this).closest(".input-group").find(".prop-element");
property_list = [settings_components.extract_property_name($elem, true)];
}
- confirm_resetting_user_setting_to_default(property_list);
+ const $status_element = $(this)
+ .closest(".settings-subsection-parent")
+ .find(".alert-notification");
+ confirm_resetting_user_setting_to_default(property_list, $status_element);
});
maybe_disable_widgets();
diff --git a/web/templates/settings/notification_settings.hbs b/web/templates/settings/notification_settings.hbs
index 34c71b9de3c..f7c2aad57e2 100644
--- a/web/templates/settings/notification_settings.hbs
+++ b/web/templates/settings/notification_settings.hbs
@@ -5,7 +5,7 @@
{{#if for_realm_settings}}
{{> ../components/icon_button icon="reset" intent="neutral" custom_classes="reset-user-setting-to-default" data-tippy-content=(t "Reset users to default") aria-label=(t "Reset users to default") }}
{{/if}}
- {{> settings_save_discard_widget section_name="general-notify-settings" show_save_discard_buttons=for_realm_settings show_saving_indicator=(not for_realm_settings) }}
+ {{> settings_save_discard_widget section_name="general-notify-settings" show_save_discard_buttons=for_realm_settings show_saving_indicator=true }}
</div>
<p>{{t "Configure how Zulip notifies you about new messages. In muted channels, channel notification settings apply only to unmuted topics." }}</p>
<table class="notification-table table table-bordered wrapped-table">
@@ -79,7 +79,7 @@
<h3>{{t "Topic notifications" }}
{{> ../help_link_widget link="/help/topic-notifications" }}
</h3>
- {{> settings_save_discard_widget section_name="topic-notifications-settings" show_save_discard_buttons=for_realm_settings show_saving_indicator=(not for_realm_settings) }}
+ {{> settings_save_discard_widget section_name="topic-notifications-settings" show_save_discard_buttons=for_realm_settings show_saving_indicator=true }}
</div>
<p>
{{#tr}}
@@ -143,7 +143,7 @@
<h3>{{t "Desktop message notifications" }}
{{> ../help_link_widget link="/help/desktop-notifications" }}
</h3>
- {{> settings_save_discard_widget section_name="desktop-message-settings" show_save_discard_buttons=for_realm_settings show_saving_indicator=(not for_realm_settings) }}
+ {{> settings_save_discard_widget section_name="desktop-message-settings" show_save_discard_buttons=for_realm_settings show_saving_indicator=true }}
</div>
{{#if (eq prefix "user_")}}
@@ -210,7 +210,7 @@
<h3>{{t "Mobile message notifications" }}
{{> ../help_link_widget link="/help/mobile-notifications" }}
</h3>
- {{> settings_save_discard_widget section_name="mobile-message-settings" show_save_discard_buttons=for_realm_settings show_saving_indicator=(not for_realm_settings) }}
+ {{> settings_save_discard_widget section_name="mobile-message-settings" show_save_discard_buttons=for_realm_settings show_saving_indicator=true }}
</div>
{{#unless realm_push_notifications_enabled}}
<div class="mobile-push-notifications-banner-container banner-wrapper">
@@ -234,7 +234,7 @@
<h3>{{t "Email message notifications" }}
{{> ../help_link_widget link="/help/email-notifications" }}
</h3>
- {{> settings_save_discard_widget section_name="email-message-settings" show_save_discard_buttons=for_realm_settings show_saving_indicator=(not for_realm_settings) }}
+ {{> settings_save_discard_widget section_name="email-message-settings" show_save_discard_buttons=for_realm_settings show_saving_indicator=true }}
</div>
<div class="input-group time-limit-setting">
@@ -290,7 +290,7 @@
<div class="subsection-header">
<h3>{{t "Other emails" }}</h3>
- {{> settings_save_discard_widget section_name="other-emails-settings" show_save_discard_buttons=for_realm_settings show_saving_indicator=(not for_realm_settings) }}
+ {{> settings_save_discard_widget section_name="other-emails-settings" show_save_discard_buttons=for_realm_settings show_saving_indicator=true }}
</div>
{{#each notification_settings.other_email_settings}}
{{> settings_checkbox
diff --git a/web/templates/settings/preferences_emoji.hbs b/web/templates/settings/preferences_emoji.hbs
index 60b79eae628..267c4cdd67b 100644
--- a/web/templates/settings/preferences_emoji.hbs
+++ b/web/templates/settings/preferences_emoji.hbs
@@ -1,7 +1,7 @@
<div class="emoji-preferences {{#if for_realm_settings}}settings-subsection-parent{{else}}subsection-parent{{/if}}">
<div class="subsection-header">
<h3 class="light">{{t "Emoji" }}</h3>
- {{> settings_save_discard_widget section_name="emoji-preferences-settings" show_save_discard_buttons=for_realm_settings show_saving_indicator=(not for_realm_settings) }}
+ {{> settings_save_discard_widget section_name="emoji-preferences-settings" show_save_discard_buttons=for_realm_settings show_saving_indicator=true }}
</div>
<div class="input-group">
diff --git a/web/templates/settings/preferences_general.hbs b/web/templates/settings/preferences_general.hbs
index fe1331f832c..e2e09331510 100644
--- a/web/templates/settings/preferences_general.hbs
+++ b/web/templates/settings/preferences_general.hbs
@@ -3,7 +3,7 @@
it. If there's not an alert, don't make it inline-block.-->
<div class="subsection-header">
<h3>{{t "General" }}</h3>
- {{> settings_save_discard_widget section_name="general-settings" show_save_discard_buttons=for_realm_settings show_saving_indicator=(not for_realm_settings) }}
+ {{> settings_save_discard_widget section_name="general-settings" show_save_discard_buttons=for_realm_settings show_saving_indicator=true }}
</div>
{{#unless for_realm_settings}}
{{> ../dropdown_widget_with_label
diff --git a/web/templates/settings/preferences_information.hbs b/web/templates/settings/preferences_information.hbs
index ae3560d142f..4cba9d8b07a 100644
--- a/web/templates/settings/preferences_information.hbs
+++ b/web/templates/settings/preferences_information.hbs
@@ -1,7 +1,7 @@
<div class="information-settings {{#if for_realm_settings}}settings-subsection-parent{{else}}subsection-parent{{/if}}">
<div class="subsection-header">
<h3 class="light">{{t "Information" }}</h3>
- {{> settings_save_discard_widget section_name="information-settings" show_save_discard_buttons=for_realm_settings show_saving_indicator=(not for_realm_settings) }}
+ {{> settings_save_discard_widget section_name="information-settings" show_save_discard_buttons=for_realm_settings show_saving_indicator=true }}
</div>
<div class="input-group">
diff --git a/web/templates/settings/preferences_left_sidebar.hbs b/web/templates/settings/preferences_left_sidebar.hbs
index ce0ef158e80..403a60a2cd0 100644
--- a/web/templates/settings/preferences_left_sidebar.hbs
+++ b/web/templates/settings/preferences_left_sidebar.hbs
@@ -1,7 +1,7 @@
<div class="left-sidebar-settings {{#if for_realm_settings}}settings-subsection-parent{{else}}subsection-parent{{/if}}">
<div class="subsection-header">
<h3 class="light">{{t "Left sidebar" }}</h3>
- {{> settings_save_discard_widget section_name="left-sidebar-settings" show_save_discard_buttons=for_realm_settings show_saving_indicator=(not for_realm_settings) }}
+ {{> settings_save_discard_widget section_name="left-sidebar-settings" show_save_discard_buttons=for_realm_settings show_saving_indicator=true }}
</div>
<div class="input-group">
diff --git a/web/templates/settings/preferences_navigation.hbs b/web/templates/settings/preferences_navigation.hbs
index bb0a7552fb7..6c06bac4ec4 100644
--- a/web/templates/settings/preferences_navigation.hbs
+++ b/web/templates/settings/preferences_navigation.hbs
@@ -1,7 +1,7 @@
<div class="navigation-settings {{#if for_realm_settings}}settings-subsection-parent{{else}}subsection-parent{{/if}}">
<div class="subsection-header">
<h3 class="light">{{t "Navigation" }}</h3>
- {{> settings_save_discard_widget section_name="navigation-settings" show_save_discard_buttons=for_realm_settings show_saving_indicator=(not for_realm_settings) }}
+ {{> settings_save_discard_widget section_name="navigation-settings" show_save_discard_buttons=for_realm_settings show_saving_indicator=true }}
</div>
<div class="input-group">