From 88df01bee5ff2087a684812cb7c46dbc6a85ad51 Mon Sep 17 00:00:00 2001 From: Vector73 Date: Mon, 3 Jun 2024 14:19:57 +0530 Subject: [PATCH] web: Replace `realm_uri` with `realm_url` in frontend files. Replaces `realm_uri` with `realm_url` in some frontend files and a js test. --- web/src/demo_organizations_ui.js | 4 ++-- web/src/integration_url_modal.ts | 2 +- web/src/popover_menus_data.js | 2 +- web/src/settings_bots.js | 4 ++-- web/src/state_data.ts | 2 +- web/src/topic_popover.js | 2 +- web/src/ui_init.js | 2 +- web/src/user_deactivation_ui.ts | 2 +- web/tests/settings_bots.test.js | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/web/src/demo_organizations_ui.js b/web/src/demo_organizations_ui.js index 8a42f98103..5bf20ad7eb 100644 --- a/web/src/demo_organizations_ui.js +++ b/web/src/demo_organizations_ui.js @@ -30,7 +30,7 @@ export function handle_demo_organization_conversion() { } const email_set = !settings_data.user_email_not_configured(); - const parts = new URL(realm.realm_uri).hostname.split("."); + const parts = new URL(realm.realm_url).hostname.split("."); parts.shift(); const domain = parts.join("."); const html_body = render_convert_demo_organization_form({ @@ -74,7 +74,7 @@ export function handle_demo_organization_conversion() { }; const opts = { success_continuation(data) { - window.location.href = data.realm_uri; + window.location.href = data.realm_url; }, }; dialog_widget.submit_api_request(channel.patch, "/json/realm", data, opts); diff --git a/web/src/integration_url_modal.ts b/web/src/integration_url_modal.ts index 17b56acea0..480fa419db 100644 --- a/web/src/integration_url_modal.ts +++ b/web/src/integration_url_modal.ts @@ -138,7 +138,7 @@ export function show_generate_integration_url_modal(api_key: string): void { } const selected_events = set_events_param(params); - const realm_url = realm.realm_uri; + const realm_url = realm.realm_url; const base_url = `${realm_url}/api/v1/external/`; $integration_url.text(`${base_url}${selected_integration}?${params.toString()}`); $dialog_submit_button.prop("disabled", false); diff --git a/web/src/popover_menus_data.js b/web/src/popover_menus_data.js index c893e5a3eb..bdc5a443d2 100644 --- a/web/src/popover_menus_data.js +++ b/web/src/popover_menus_data.js @@ -202,7 +202,7 @@ export function get_gear_menu_content_context() { const is_org_on_paid_plan = is_plan_standard || is_plan_plus; return { realm_name: realm.realm_name, - realm_url: new URL(realm.realm_uri).hostname, + realm_url: new URL(realm.realm_url).hostname, is_owner: current_user.is_owner, is_admin: current_user.is_admin, is_spectator: page_params.is_spectator, diff --git a/web/src/settings_bots.js b/web/src/settings_bots.js index d2cebfd9e6..0ebc7d6f0d 100644 --- a/web/src/settings_bots.js +++ b/web/src/settings_bots.js @@ -100,7 +100,7 @@ export function generate_zuliprc_content(bot) { "\nkey=" + bot.api_key + "\nsite=" + - realm.realm_uri + + realm.realm_url + (token === undefined ? "" : "\ntoken=" + token) + // Some tools would not work in files without a trailing new line. "\n" @@ -115,7 +115,7 @@ export function generate_botserverrc_content(email, api_key, token) { "\nkey=" + api_key + "\nsite=" + - realm.realm_uri + + realm.realm_url + "\ntoken=" + token + "\n" diff --git a/web/src/state_data.ts b/web/src/state_data.ts index 30d6af343e..2735c320a7 100644 --- a/web/src/state_data.ts +++ b/web/src/state_data.ts @@ -163,7 +163,7 @@ export const realm_schema = z.object({ realm_require_unique_names: z.boolean(), realm_signup_announcements_stream_id: z.number(), realm_upload_quota_mib: z.nullable(z.number()), - realm_uri: z.string(), + realm_url: z.string(), realm_user_group_edit_policy: z.number(), realm_video_chat_provider: z.number(), realm_waiting_period_threshold: z.number(), diff --git a/web/src/topic_popover.js b/web/src/topic_popover.js index d3ca4215f9..935723d606 100644 --- a/web/src/topic_popover.js +++ b/web/src/topic_popover.js @@ -34,7 +34,7 @@ export function initialize() { const $elt = $(instance.reference); stream_id = Number.parseInt($elt.attr("data-stream-id"), 10); topic_name = $elt.attr("data-topic-name"); - url = new URL($elt.attr("data-topic-url"), realm.realm_uri); + url = new URL($elt.attr("data-topic-url"), realm.realm_url); } else { const $elt = $(instance.reference) .closest(".topic-sidebar-menu-icon") diff --git a/web/src/ui_init.js b/web/src/ui_init.js index f724376179..fbd0773ebd 100644 --- a/web/src/ui_init.js +++ b/web/src/ui_init.js @@ -620,7 +620,7 @@ export function initialize_everything(state_data) { "realm_send_welcome_emails", "realm_signup_announcements_stream_id", "realm_upload_quota_mib", - "realm_uri", + "realm_url", "realm_user_group_edit_policy", "realm_video_chat_provider", "realm_waiting_period_threshold", diff --git a/web/src/user_deactivation_ui.ts b/web/src/user_deactivation_ui.ts index ab03ce96de..104efe9c03 100644 --- a/web/src/user_deactivation_ui.ts +++ b/web/src/user_deactivation_ui.ts @@ -38,7 +38,7 @@ export function confirm_deactivation( const bots_owned_by_user = bot_data.get_all_bots_owned_by_user(user_id); const user = people.get_by_user_id(user_id); - const realm_url = realm.realm_uri; + const realm_url = realm.realm_url; const realm_name = realm.realm_name; const opts = { username: user.full_name, diff --git a/web/tests/settings_bots.test.js b/web/tests/settings_bots.test.js index e2044fbe16..84d71d4289 100644 --- a/web/tests/settings_bots.test.js +++ b/web/tests/settings_bots.test.js @@ -34,7 +34,7 @@ bot_data.initialize(bot_data_params); function test(label, f) { run_test(label, ({override}) => { - realm.realm_uri = "https://chat.example.com"; + realm.realm_url = "https://chat.example.com"; realm.realm_embedded_bots = [ {name: "converter", config: {}}, {name: "giphy", config: {key: "12345678"}},