From 49a9954413410a92198d41213b5109332eb91f73 Mon Sep 17 00:00:00 2001 From: Aditya Kumar Kasaudhan Date: Wed, 10 Jan 2024 01:06:02 +0530 Subject: [PATCH] settings: Rename settings_display to settings_preferences. This commit renames "settings_display.js" file to "settings_preferences.js". Fixes part of #26874. --- tools/test-js-with-node | 2 +- web/src/click_handlers.js | 4 ++-- web/src/gear_menu.js | 4 ++-- web/src/server_events_dispatch.js | 15 ++++++++------- web/src/settings.js | 4 ++-- ...ettings_display.js => settings_preferences.js} | 0 web/src/settings_realm_user_settings_defaults.js | 4 ++-- web/src/settings_sections.js | 4 ++-- web/src/ui_init.js | 4 ++-- web/tests/dispatch.test.js | 10 +++++----- 10 files changed, 26 insertions(+), 25 deletions(-) rename web/src/{settings_display.js => settings_preferences.js} (100%) diff --git a/tools/test-js-with-node b/tools/test-js-with-node index 74a7266e51..f7eee13b8a 100755 --- a/tools/test-js-with-node +++ b/tools/test-js-with-node @@ -200,7 +200,6 @@ EXEMPT_FILES = make_set( "web/src/settings_account.js", "web/src/settings_bots.js", "web/src/settings_components.js", - "web/src/settings_display.js", "web/src/settings_emoji.ts", "web/src/settings_exports.ts", "web/src/settings_invites.ts", @@ -210,6 +209,7 @@ EXEMPT_FILES = make_set( "web/src/settings_org.js", "web/src/settings_panel_menu.js", "web/src/settings_playgrounds.js", + "web/src/settings_preferences.js", "web/src/settings_profile_fields.js", "web/src/settings_realm_domains.ts", "web/src/settings_realm_user_settings_defaults.js", diff --git a/web/src/click_handlers.js b/web/src/click_handlers.js index 15c1786a7d..ce80249e02 100644 --- a/web/src/click_handlers.js +++ b/web/src/click_handlers.js @@ -28,8 +28,8 @@ import * as reactions from "./reactions"; import * as recent_view_ui from "./recent_view_ui"; import * as rows from "./rows"; import * as server_events from "./server_events"; -import * as settings_display from "./settings_display"; import * as settings_panel_menu from "./settings_panel_menu"; +import * as settings_preferences from "./settings_preferences"; import * as settings_toggle from "./settings_toggle"; import * as sidebar_ui from "./sidebar_ui"; import * as spectators from "./spectators"; @@ -783,7 +783,7 @@ export function initialize() { $("body").on("click", ".language_selection_widget button", (e) => { e.preventDefault(); e.stopPropagation(); - settings_display.launch_default_language_setting_modal(); + settings_preferences.launch_default_language_setting_modal(); }); $("body").on("click", "#header-container .brand", (e) => { diff --git a/web/src/gear_menu.js b/web/src/gear_menu.js index 4c69d2998d..2d59474901 100644 --- a/web/src/gear_menu.js +++ b/web/src/gear_menu.js @@ -10,7 +10,7 @@ import * as message_lists from "./message_lists"; import * as popover_menus from "./popover_menus"; import * as popover_menus_data from "./popover_menus_data"; import * as popovers from "./popovers"; -import * as settings_display from "./settings_display"; +import * as settings_preferences from "./settings_preferences"; import {parse_html} from "./ui_util"; /* @@ -154,7 +154,7 @@ export function initialize() { instance.hide(); e.preventDefault(); e.stopPropagation(); - settings_display.launch_default_language_setting_modal(); + settings_preferences.launch_default_language_setting_modal(); }); // We cannot update recipient bar color using dark_theme.enable/disable due to diff --git a/web/src/server_events_dispatch.js b/web/src/server_events_dispatch.js index 45ae0f7a88..2eb0088a69 100644 --- a/web/src/server_events_dispatch.js +++ b/web/src/server_events_dispatch.js @@ -51,7 +51,6 @@ import * as scroll_bar from "./scroll_bar"; import * as settings_account from "./settings_account"; import * as settings_bots from "./settings_bots"; import * as settings_config from "./settings_config"; -import * as settings_display from "./settings_display"; import * as settings_emoji from "./settings_emoji"; import * as settings_exports from "./settings_exports"; import * as settings_invites from "./settings_invites"; @@ -59,6 +58,7 @@ import * as settings_linkifiers from "./settings_linkifiers"; import * as settings_notifications from "./settings_notifications"; import * as settings_org from "./settings_org"; import * as settings_playgrounds from "./settings_playgrounds"; +import * as settings_preferences from "./settings_preferences"; import * as settings_profile_fields from "./settings_profile_fields"; import * as settings_realm_domains from "./settings_realm_domains"; import * as settings_realm_user_settings_defaults from "./settings_realm_user_settings_defaults"; @@ -716,7 +716,7 @@ export function dispatch_normal_event(event) { // a reload is fundamentally required because we // cannot rerender with the new language the strings // present in the backend/Jinja2 templates. - settings_display.set_default_language_name(event.language_name); + settings_preferences.set_default_language_name(event.language_name); } if (event.property === "web_home_view") { left_sidebar_navigation_area.handle_home_view_changed(event.value); @@ -750,8 +750,8 @@ export function dispatch_normal_event(event) { stream_list.update_dom_unread_counts_visibility(); } if (event.property === "user_list_style") { - settings_display.report_user_list_style_change( - settings_display.user_settings_panel, + settings_preferences.report_user_list_style_change( + settings_preferences.user_settings_panel, ); activity_ui.build_user_sidebar(); } @@ -791,8 +791,9 @@ export function dispatch_normal_event(event) { // reload. } if (event.property === "emojiset") { - settings_display.report_emojiset_change(settings_display.user_settings_panel); - + settings_preferences.report_emojiset_change( + settings_preferences.user_settings_panel, + ); // Rerender the whole message list UI for (const msg_list of message_lists.all_rendered_message_lists()) { msg_list.rerender(); @@ -824,7 +825,7 @@ export function dispatch_normal_event(event) { $("#user_email_address_visibility").val(event.value); break; } - settings_display.update_page(event.property); + settings_preferences.update_page(event.property); break; } diff --git a/web/src/settings.js b/web/src/settings.js index 33f92dfb29..292fbca70f 100644 --- a/web/src/settings.js +++ b/web/src/settings.js @@ -15,8 +15,8 @@ import * as people from "./people"; import * as settings_bots from "./settings_bots"; import * as settings_config from "./settings_config"; import * as settings_data from "./settings_data"; -import * as settings_display from "./settings_display"; import * as settings_panel_menu from "./settings_panel_menu"; +import * as settings_preferences from "./settings_preferences"; import * as settings_sections from "./settings_sections"; import * as settings_toggle from "./settings_toggle"; import * as timerender from "./timerender"; @@ -139,7 +139,7 @@ export function build_page() { user_can_change_avatar: settings_data.user_can_change_avatar(), user_can_change_email: settings_data.user_can_change_email(), user_role_text: people.get_user_type(page_params.user_id), - default_language_name: settings_display.user_default_language_name, + default_language_name: settings_preferences.user_default_language_name, default_language: user_settings.default_language, realm_push_notifications_enabled: page_params.realm_push_notifications_enabled, settings_object: user_settings, diff --git a/web/src/settings_display.js b/web/src/settings_preferences.js similarity index 100% rename from web/src/settings_display.js rename to web/src/settings_preferences.js diff --git a/web/src/settings_realm_user_settings_defaults.js b/web/src/settings_realm_user_settings_defaults.js index 0826cecd6c..b02bab2ed2 100644 --- a/web/src/settings_realm_user_settings_defaults.js +++ b/web/src/settings_realm_user_settings_defaults.js @@ -5,9 +5,9 @@ import * as overlays from "./overlays"; import {page_params} from "./page_params"; import {realm_user_settings_defaults} from "./realm_user_settings_defaults"; import * as settings_components from "./settings_components"; -import * as settings_display from "./settings_display"; import * as settings_notifications from "./settings_notifications"; import * as settings_org from "./settings_org"; +import * as settings_preferences from "./settings_preferences"; export const realm_default_settings_panel = {}; @@ -58,7 +58,7 @@ export function set_up() { const $notification_sound_elem = $("audio#realm-default-notification-sound-audio"); const $notification_sound_dropdown = $container.find(".setting_notification_sound"); - settings_display.set_up(realm_default_settings_panel); + settings_preferences.set_up(realm_default_settings_panel); audible_notifications.update_notification_sound_source( $notification_sound_elem, diff --git a/web/src/settings_sections.js b/web/src/settings_sections.js index e82a0c45cc..41e171662f 100644 --- a/web/src/settings_sections.js +++ b/web/src/settings_sections.js @@ -3,7 +3,6 @@ import * as attachments_ui from "./attachments_ui"; import * as blueslip from "./blueslip"; import * as settings_account from "./settings_account"; import * as settings_bots from "./settings_bots"; -import * as settings_display from "./settings_display"; import * as settings_emoji from "./settings_emoji"; import * as settings_exports from "./settings_exports"; import * as settings_invites from "./settings_invites"; @@ -12,6 +11,7 @@ import * as settings_muted_users from "./settings_muted_users"; import * as settings_notifications from "./settings_notifications"; import * as settings_org from "./settings_org"; import * as settings_playgrounds from "./settings_playgrounds"; +import * as settings_preferences from "./settings_preferences"; import * as settings_profile_fields from "./settings_profile_fields"; import * as settings_realm_user_settings_defaults from "./settings_realm_user_settings_defaults"; import * as settings_streams from "./settings_streams"; @@ -51,7 +51,7 @@ export function initialize() { // personal load_func_dict.set("your-account", settings_account.set_up); load_func_dict.set("preferences", () => { - settings_display.set_up(settings_display.user_settings_panel); + settings_preferences.set_up(settings_preferences.user_settings_panel); }); load_func_dict.set("notifications", () => { settings_notifications.set_up(settings_notifications.user_settings_panel); diff --git a/web/src/ui_init.js b/web/src/ui_init.js index b7281ee0ba..4a58a6a693 100644 --- a/web/src/ui_init.js +++ b/web/src/ui_init.js @@ -102,9 +102,9 @@ import * as search from "./search"; import * as server_events from "./server_events"; import * as settings from "./settings"; import * as settings_data from "./settings_data"; -import * as settings_display from "./settings_display"; import * as settings_notifications from "./settings_notifications"; import * as settings_panel_menu from "./settings_panel_menu"; +import * as settings_preferences from "./settings_preferences"; import * as settings_realm_user_settings_defaults from "./settings_realm_user_settings_defaults"; import * as settings_sections from "./settings_sections"; import * as settings_toggle from "./settings_toggle"; @@ -655,7 +655,7 @@ export function initialize_everything() { navbar_help_menu.initialize(); giphy.initialize(); presence.initialize(presence_params); - settings_display.initialize(); + settings_preferences.initialize(); settings_notifications.initialize(); settings_realm_user_settings_defaults.initialize(); settings_panel_menu.initialize(); diff --git a/web/tests/dispatch.test.js b/web/tests/dispatch.test.js index 6ce0ddbd1c..dc333d8590 100644 --- a/web/tests/dispatch.test.js +++ b/web/tests/dispatch.test.js @@ -47,7 +47,6 @@ const scheduled_messages_ui = mock_esm("../src/scheduled_messages_ui"); const scroll_bar = mock_esm("../src/scroll_bar"); const settings_account = mock_esm("../src/settings_account"); const settings_bots = mock_esm("../src/settings_bots"); -const settings_display = mock_esm("../src/settings_display"); const settings_emoji = mock_esm("../src/settings_emoji"); const settings_exports = mock_esm("../src/settings_exports"); const settings_invites = mock_esm("../src/settings_invites"); @@ -56,6 +55,7 @@ const settings_playgrounds = mock_esm("../src/settings_playgrounds"); const settings_notifications = mock_esm("../src/settings_notifications"); const settings_org = mock_esm("../src/settings_org"); const settings_profile_fields = mock_esm("../src/settings_profile_fields"); +const settings_preferences = mock_esm("../src/settings_preferences"); const settings_realm_user_settings_defaults = mock_esm( "../src/settings_realm_user_settings_defaults", ); @@ -832,10 +832,10 @@ run_test("stream_typing", ({override}) => { }); run_test("user_settings", ({override}) => { - settings_display.set_default_language_name = noop; + settings_preferences.set_default_language_name = () => {}; let event = event_fixtures.user_settings__default_language; user_settings.default_language = "en"; - override(settings_display, "update_page", noop); + override(settings_preferences, "update_page", noop); override(overlays, "settings_open", () => true); dispatch(event); assert_same(user_settings.default_language, "fr"); @@ -952,7 +952,7 @@ run_test("user_settings", ({override}) => { const stub = make_stub(); event = event_fixtures.user_settings__emojiset; called = false; - override(settings_display, "report_emojiset_change", stub.f); + override(settings_preferences, "report_emojiset_change", stub.f); override(activity_ui, "build_user_sidebar", noop); user_settings.emojiset = "text"; dispatch(event); @@ -996,7 +996,7 @@ run_test("user_settings", ({override}) => { { const stub = make_stub(); event = event_fixtures.user_settings__user_list_style; - override(settings_display, "report_user_list_style_change", stub.f); + override(settings_preferences, "report_user_list_style_change", stub.f); user_settings.user_list_style = 1; override(activity_ui, "build_user_sidebar", stub.f); dispatch(event);