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.

eslint: Fix unicorn/prefer-url-href.

Anders Kaseorgdc0412508466
diff --git a/starlight_help/astro.config.mjs b/starlight_help/astro.config.mjs
index 955c92b87df..51d312eff40 100644
--- a/starlight_help/astro.config.mjs
+++ b/starlight_help/astro.config.mjs
@@ -65,7 +65,7 @@ function createRedirectPlugin() {
// run-dev being run with `--only-help-center` flag.
if (redirectUrl.port !== proxyPort) {
redirectUrl.port = proxyPort;
- res.writeHead(302, {Location: redirectUrl.toString()});
+ res.writeHead(302, {Location: redirectUrl.href});
res.end();
return;
}
diff --git a/web/src/base_page_params.ts b/web/src/base_page_params.ts
index 0112ba6b19e..5dbd79086fb 100644
--- a/web/src/base_page_params.ts
+++ b/web/src/base_page_params.ts
@@ -150,7 +150,7 @@ function reload_with_deferred_state_data(): boolean {
const backoff_ms =
get_retry_backoff_seconds(undefined, previous_retries + 1, false, true) * 1000;
setTimeout(() => {
- window.location.replace(url.toString());
+ window.location.replace(url);
}, backoff_ms);
return true;
}
@@ -159,7 +159,7 @@ function clear_page_params_retry_from_url(): void {
const url = new URL(window.location.href);
if (url.searchParams.has("page_params_retry")) {
url.searchParams.delete("page_params_retry");
- window.history.replaceState(window.history.state, "", url.toString());
+ window.history.replaceState(window.history.state, "", url);
}
}
diff --git a/web/src/billing/billing.ts b/web/src/billing/billing.ts
index 68c03f82a09..67a930f6f0a 100644
--- a/web/src/billing/billing.ts
+++ b/web/src/billing/billing.ts
@@ -77,7 +77,7 @@ function remove_unused_get_parameters(): void {
// it being displayed repeatedly on reloads.
const url = new URL(window.location.href);
url.searchParams.delete("success_message");
- window.history.replaceState(null, "", url.toString());
+ window.history.replaceState(null, "", url);
}
export function initialize(): void {
diff --git a/web/src/portico/signup.ts b/web/src/portico/signup.ts
index 58542919bd0..668c651b254 100644
--- a/web/src/portico/signup.ts
+++ b/web/src/portico/signup.ts
@@ -420,7 +420,7 @@ $(() => {
// Ensure we don't double-add hashes and handle query parameters properly
const url = new URL(new_org_url);
url.hash = url_hash;
- new_org_url = url.toString();
+ new_org_url = url.href;
}
$deactivated_org_auto_redirect.attr("href", new_org_url);
diff --git a/web/src/postprocess_content.ts b/web/src/postprocess_content.ts
index c4e69b47ba1..4bdb7602116 100644
--- a/web/src/postprocess_content.ts
+++ b/web/src/postprocess_content.ts
@@ -103,7 +103,7 @@ export function postprocess_content(html: string): string {
},
);
} else {
- title = url.toString();
+ title = url.href;
legacy_title = href;
}
elt.setAttribute(
diff --git a/web/src/reload.ts b/web/src/reload.ts
index 7e254666aa7..a958233a557 100644
--- a/web/src/reload.ts
+++ b/web/src/reload.ts
@@ -211,7 +211,7 @@ function do_reload_app(
blueslip.error("Failed to clean up before reloading", undefined, error);
}
- window.location.replace(reload_url.toString());
+ window.location.replace(reload_url);
}
export function initiate({
diff --git a/web/src/ui_init.js b/web/src/ui_init.js
index 6076eb1f51d..42c7d8139d8 100644
--- a/web/src/ui_init.js
+++ b/web/src/ui_init.js
@@ -834,7 +834,7 @@ $(() => {
needs_url_cleanup = true;
}
if (needs_url_cleanup) {
- window.history.replaceState(window.history.state, "", url.toString());
+ window.history.replaceState(window.history.state, "", url);
}
if (page_params.no_event_queue) {