Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
web: Use `uri` instead of `url`.
AcKindle302364dd69f37
diff --git a/stylelint.config.js b/stylelint.config.jsindex e8c5cf7bde5..53feeb88105 100644--- a/stylelint.config.js+++ b/stylelint.config.js@@ -37,7 +37,7 @@ module.exports = {// Zulip CSS should have no dependencies on external resources"function-url-no-scheme-relative": true,"function-url-scheme-allowed-list": [- "data", // Allow data URIs+ "data", // Allow data URLs],},};diff --git a/web/src/filter.js b/web/src/filter.jsindex a33a7fb7c53..ec6dbc2dccf 100644--- a/web/src/filter.js+++ b/web/src/filter.js@@ -285,7 +285,7 @@ export class Filter {if (["group-pm-with", "pm-with", "sender", "from"].includes(operator) === false) {encoded = encoded.replace(/\+/g, " ");}- return util.robust_uri_decode(encoded).trim();+ return util.robust_url_decode(encoded).trim();}// Parse a string into a list of operators (see below).diff --git a/web/src/gear_menu.ts b/web/src/gear_menu.tsindex 7d3203989fc..b5b4ce479c0 100644--- a/web/src/gear_menu.ts+++ b/web/src/gear_menu.ts@@ -113,7 +113,7 @@ export function version_display_string(): string {export function initialize(): void {const rendered_gear_menu = render_gear_menu({realm_name: page_params.realm_name,- realm_uri: new URL(page_params.realm_uri).hostname,+ realm_url: new URL(page_params.realm_uri).hostname,is_owner: page_params.is_owner,is_admin: page_params.is_admin,is_self_hosted: page_params.realm_plan_type === 1,diff --git a/web/src/people.js b/web/src/people.jsindex a02b7fd91a7..d275cec25bf 100644--- a/web/src/people.js+++ b/web/src/people.js@@ -534,8 +534,8 @@ export function pm_perma_link(message) {}const slug = user_ids.join(",") + "-" + suffix;- const uri = "#narrow/pm-with/" + slug;- return uri;+ const url = "#narrow/pm-with/" + slug;+ return url;}export function pm_with_url(message) {@@ -560,8 +560,8 @@ export function pm_with_url(message) {}const slug = user_ids.join(",") + "-" + suffix;- const uri = "#narrow/pm-with/" + slug;- return uri;+ const url = "#narrow/pm-with/" + slug;+ return url;}export function update_email_in_reply_to(reply_to, user_id, new_email) {diff --git a/web/src/popover_menus_data.js b/web/src/popover_menus_data.jsindex 62b1c97a40f..cb4b9a4bf94 100644--- a/web/src/popover_menus_data.js+++ b/web/src/popover_menus_data.js@@ -87,7 +87,7 @@ export function get_actions_popover_content_context(message_id) {const should_display_quote_and_reply = message.content !== "<p>(deleted)</p>" && not_spectator;- const conversation_time_uri = hash_util.by_conversation_and_time_url(message);+ const conversation_time_url = hash_util.by_conversation_and_time_url(message);const should_display_delete_option = message_edit.get_deletability(message) && not_spectator;const should_display_read_receipts_option =@@ -116,7 +116,7 @@ export function get_actions_popover_content_context(message_id) {should_display_add_reaction_option,should_display_edit_history_option,should_display_hide_option,- conversation_time_uri,+ conversation_time_url,narrowed: narrow_state.active(),should_display_delete_option,should_display_read_receipts_option,diff --git a/web/src/popovers.js b/web/src/popovers.jsindex 86142dcdfde..144bf035c02 100644--- a/web/src/popovers.js+++ b/web/src/popovers.js@@ -275,7 +275,7 @@ function render_user_info_popover(pm_with_url: hash_util.pm_with_url(user.email),user_circle_class: buddy_data.get_user_circle_class(user.user_id),private_message_class: private_msg_class,- sent_by_uri: hash_util.by_sender_url(user.email),+ sent_by_url: hash_util.by_sender_url(user.email),show_manage_menu,user_email: user.delivery_email,user_full_name: user.full_name,diff --git a/web/src/settings_account.js b/web/src/settings_account.jsindex 0366d23da18..b0f38d3f37f 100644--- a/web/src/settings_account.js+++ b/web/src/settings_account.js@@ -498,7 +498,7 @@ export function set_up() {api_key: $("#api_key_value").text(),};const data = settings_bots.generate_zuliprc_content(bot_object);- $(this).attr("href", settings_bots.encode_zuliprc_as_uri(data));+ $(this).attr("href", settings_bots.encode_zuliprc_as_url(data));});$("#api_key_modal [data-micromodal-close]").on("click", () => {diff --git a/web/src/settings_bots.js b/web/src/settings_bots.jsindex 5525569faa6..f0a3f71fefb 100644--- a/web/src/settings_bots.js+++ b/web/src/settings_bots.js@@ -82,13 +82,13 @@ export function render_bots() {}}-export function generate_zuliprc_uri(bot_id) {+export function generate_zuliprc_url(bot_id) {const bot = bot_data.get(bot_id);const data = generate_zuliprc_content(bot);- return encode_zuliprc_as_uri(data);+ return encode_zuliprc_as_url(data);}-export function encode_zuliprc_as_uri(zuliprc) {+export function encode_zuliprc_as_url(zuliprc) {return "data:application/octet-stream;charset=utf-8," + encodeURIComponent(zuliprc);}@@ -596,7 +596,7 @@ export function set_up() {$("#active_bots_list").on("click", "a.download_bot_zuliprc", function () {const $bot_info = $(this).closest(".bot-information-box").find(".bot_info");const bot_id = Number.parseInt($bot_info.attr("data-user-id"), 10);- $(this).attr("href", generate_zuliprc_uri(bot_id));+ $(this).attr("href", generate_zuliprc_url(bot_id));});$("#active_bots_list").on("click", "button.open_bots_subscribed_streams", (e) => {diff --git a/web/src/settings_users.js b/web/src/settings_users.jsindex ee3906e284f..ff98046dec3 100644--- a/web/src/settings_users.js+++ b/web/src/settings_users.js@@ -476,7 +476,7 @@ export function confirm_deactivation(user_id, handle_confirm, loading_spinner) {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_uri = page_params.realm_uri;+ const realm_url = page_params.realm_uri;const realm_name = page_params.realm_name;const opts = {username: user.full_name,@@ -484,7 +484,7 @@ export function confirm_deactivation(user_id, handle_confirm, loading_spinner) {bots_owned_by_user,number_of_invites_by_user,admin_email: people.my_current_email(),- realm_uri,+ realm_url,realm_name,};const html_body = render_settings_deactivation_user_modal(opts);diff --git a/web/src/stream_list.js b/web/src/stream_list.jsindex b0a183c2544..1719fbf2bbd 100644--- a/web/src/stream_list.js+++ b/web/src/stream_list.js@@ -318,7 +318,7 @@ function build_stream_sidebar_li(sub) {const args = {name,id: sub.stream_id,- uri: hash_util.by_stream_url(sub.stream_id),+ url: hash_util.by_stream_url(sub.stream_id),is_muted: stream_data.is_muted(sub.stream_id) === true,invite_only: sub.invite_only,is_web_public: sub.is_web_public,diff --git a/web/src/upload.js b/web/src/upload.jsindex 8fef92e3c51..b3077532e01 100644--- a/web/src/upload.js+++ b/web/src/upload.js@@ -281,19 +281,19 @@ export function setup_upload(config) {});uppy.on("upload-success", (file, response) => {- const uri = response.body.uri;- if (uri === undefined) {+ const url = response.body.uri;+ if (url === undefined) {return;}- const split_uri = uri.split("/");- const filename = split_uri.at(-1);+ const split_url = url.split("/");+ const filename = split_url.at(-1);if (config.mode === "compose" && !compose_state.composing()) {compose_actions.start("stream");}- const filename_uri = "[" + filename + "](" + uri + ")";+ const filename_url = "[" + filename + "](" + url + ")";compose_ui.replace_syntax(get_translated_status(file),- filename_uri,+ filename_url,get_item("textarea", config),);compose_ui.autosize_textarea(get_item("textarea", config));diff --git a/web/src/util.ts b/web/src/util.tsindex 0f62aeaa27e..e7ea6627f43 100644--- a/web/src/util.ts+++ b/web/src/util.ts@@ -117,7 +117,7 @@ export function normalize_recipients(recipients: string): string {// one by one until the decode succeeds. This makes sense if// we are decoding input that the user is in the middle of// typing.-export function robust_uri_decode(str: string): string {+export function robust_url_decode(str: string): string {let end = str.length;while (end > 0) {try {diff --git a/web/templates/actions_popover_content.hbs b/web/templates/actions_popover_content.hbsindex 257a1e9b098..7e22c1e1c71 100644--- a/web/templates/actions_popover_content.hbs+++ b/web/templates/actions_popover_content.hbs@@ -127,7 +127,7 @@{{/if}}<li>- <a class="copy_link" data-message-id="{{message_id}}" data-clipboard-text="{{ conversation_time_uri }}" tabindex="0">+ <a class="copy_link" data-message-id="{{message_id}}" data-clipboard-text="{{ conversation_time_url }}" tabindex="0"><i class="fa fa-link" aria-hidden="true"></i> {{t "Copy link to message" }}</a></li>diff --git a/web/templates/confirm_dialog/confirm_deactivate_user.hbs b/web/templates/confirm_dialog/confirm_deactivate_user.hbsindex b3217c9daa9..30aee0c6a98 100644--- a/web/templates/confirm_dialog/confirm_deactivate_user.hbs+++ b/web/templates/confirm_dialog/confirm_deactivate_user.hbs@@ -35,7 +35,7 @@{{#tr}}Your Zulip account on <z-link></z-link> has been deactivated,and you will no longer be able to log in.- {{#*inline "z-link"}}<a href="{{realm_uri}}">{{realm_uri}}</a>{{/inline}}+ {{#*inline "z-link"}}<a href="{{realm_url}}">{{realm_url}}</a>{{/inline}}{{/tr}}</p><p>{{t "The administrators provided the following comment:" }}</p>diff --git a/web/templates/gear_menu.hbs b/web/templates/gear_menu.hbsindex dd8c19e78d4..7199a97d384 100644--- a/web/templates/gear_menu.hbs+++ b/web/templates/gear_menu.hbs@@ -5,7 +5,7 @@</a><ul class="dropdown-menu" role="menu" aria-labelledby="settings-dropdown"><li class="org-info org-name">{{realm_name}}</li>- <li class="org-info org-url">{{realm_uri}}</li>+ <li class="org-info org-url">{{realm_url}}</li>{{#if is_self_hosted }}<li class="org-info org-version"><a href="#about-zulip" role="menuitem">{{version_display_string}}</a>diff --git a/web/templates/stream_sidebar_row.hbs b/web/templates/stream_sidebar_row.hbsindex e1da89c012e..118e4b0fe9a 100644--- a/web/templates/stream_sidebar_row.hbs+++ b/web/templates/stream_sidebar_row.hbs@@ -8,7 +8,7 @@{{> stream_privacy }}</span>- <a href="{{uri}}" title="{{name}}" class="stream-name">{{name}}</a>+ <a href="{{url}}" title="{{name}}" class="stream-name">{{name}}</a><span class="unread_mention_info"></span><span class="unread_count"></span>diff --git a/web/templates/user_info_popover_content.hbs b/web/templates/user_info_popover_content.hbsindex 86568cd2cea..e0af2f10394 100644--- a/web/templates/user_info_popover_content.hbs+++ b/web/templates/user_info_popover_content.hbs@@ -164,7 +164,7 @@</a></li><li>- <a href="{{ sent_by_uri }}" class="narrow_to_messages_sent">+ <a href="{{ sent_by_url }}" class="narrow_to_messages_sent"><i class="fa fa-paper-plane" aria-hidden="true"></i> {{t "View messages sent" }}</a></li>diff --git a/web/tests/hash_util.test.js b/web/tests/hash_util.test.jsindex aaa7d36dffd..45147a335ec 100644--- a/web/tests/hash_util.test.js+++ b/web/tests/hash_util.test.js@@ -167,8 +167,8 @@ run_test("test_by_conversation_and_time_url", () => {});run_test("test_search_public_streams_notice_url", () => {- function get_operators(uri) {- return hash_util.parse_narrow(uri.split("/"));+ function get_operators(url) {+ return hash_util.parse_narrow(url.split("/"));}assert.equal(diff --git a/web/tests/i18n.test.js b/web/tests/i18n.test.jsindex 4fa70deb321..9d5796e9c74 100644--- a/web/tests/i18n.test.js+++ b/web/tests/i18n.test.js@@ -73,7 +73,7 @@ run_test("t_tag", ({mock_template}) => {should_display_quote_and_reply: true,editability_menu_item: true,should_display_hide_option: true,- conversation_time_uri:+ conversation_time_url:"http://zulip.zulipdev.com/#narrow/stream/101-devel/topic/testing/near/99",};diff --git a/web/tests/people_errors.test.js b/web/tests/people_errors.test.jsindex 9ab6ac98dad..3218d1a937d 100644--- a/web/tests/people_errors.test.js+++ b/web/tests/people_errors.test.js@@ -106,8 +106,8 @@ run_test("blueslip", () => {blueslip.expect("error", "Unknown user_id in get_by_user_id: 42");blueslip.expect("error", "Unknown people in message");- const uri = people.pm_with_url({type: "private", display_recipient: [{id: 42}]});- assert.equal(uri.indexOf("unk"), uri.length - 3);+ const url = people.pm_with_url({type: "private", display_recipient: [{id: 42}]});+ assert.equal(url.indexOf("unk"), url.length - 3);blueslip.expect("error", "Undefined field id");assert.equal(people.my_custom_profile_data(undefined), undefined);diff --git a/web/tests/popovers.test.js b/web/tests/popovers.test.jsindex 60bf78f4d69..f643dd64856 100644--- a/web/tests/popovers.test.js+++ b/web/tests/popovers.test.js@@ -177,7 +177,7 @@ test_ui("sender_hover", ({override, mock_template}) => {user_circle_class: "user_circle_empty",user_last_seen_time_status: "translated: Active more than 2 weeks ago",pm_with_url: "#narrow/pm-with/42-Alice-Smith",- sent_by_uri: "#narrow/sender/42-Alice-Smith",+ sent_by_url: "#narrow/sender/42-Alice-Smith",private_message_class: "respond_personal_button",show_manage_menu: true,is_me: false,diff --git a/web/tests/settings_bots.test.js b/web/tests/settings_bots.test.jsindex 4ad0e1c9761..81b0805022c 100644--- a/web/tests/settings_bots.test.js+++ b/web/tests/settings_bots.test.js@@ -42,8 +42,8 @@ function test(label, f) {});}-test("generate_zuliprc_uri", () => {- const uri = settings_bots.generate_zuliprc_uri(1);+test("generate_zuliprc_url", () => {+ const url = settings_bots.generate_zuliprc_url(1);const expected ="data:application/octet-stream;charset=utf-8," +encodeURIComponent(@@ -52,7 +52,7 @@ test("generate_zuliprc_uri", () => {"site=https://chat.example.com\n",);- assert.equal(uri, expected);+ assert.equal(url, expected);});test("generate_zuliprc_content", () => {diff --git a/web/tests/stream_list.test.js b/web/tests/stream_list.test.jsindex 68349c5351f..9df43a7e4e3 100644--- a/web/tests/stream_list.test.js+++ b/web/tests/stream_list.test.js@@ -70,7 +70,7 @@ function create_devel_sidebar_row({mock_template}) {$subscription_block.set_find_results(".unread_mention_info", $devel_unread_mention_info);mock_template("stream_sidebar_row.hbs", false, (data) => {- assert.equal(data.uri, "#narrow/stream/100-devel");+ assert.equal(data.url, "#narrow/stream/100-devel");return "<devel-sidebar-row-stub>";});@@ -93,7 +93,7 @@ function create_social_sidebar_row({mock_template}) {$subscription_block.set_find_results(".unread_mention_info", $social_unread_mention_info);mock_template("stream_sidebar_row.hbs", false, (data) => {- assert.equal(data.uri, "#narrow/stream/200-social");+ assert.equal(data.url, "#narrow/stream/200-social");return "<social-sidebar-row-stub>";});@@ -662,7 +662,7 @@ test_ui("rename_stream", ({mock_template}) => {assert.deepEqual(payload, {name: "Development",id: 1000,- uri: "#narrow/stream/1000-Development",+ url: "#narrow/stream/1000-Development",is_muted: false,invite_only: undefined,is_web_public: undefined,diff --git a/web/tests/util.test.js b/web/tests/util.test.jsindex b9cecbf0411..1e5574897b4 100644--- a/web/tests/util.test.js+++ b/web/tests/util.test.js@@ -86,16 +86,16 @@ run_test("same_recipient", () => {assert.ok(!util.same_recipient(undefined, undefined));});-run_test("robust_uri_decode", ({override}) => {- assert.equal(util.robust_uri_decode("xxx%3Ayyy"), "xxx:yyy");- assert.equal(util.robust_uri_decode("xxx%3"), "xxx");+run_test("robust_url_decode", ({override}) => {+ assert.equal(util.robust_url_decode("xxx%3Ayyy"), "xxx:yyy");+ assert.equal(util.robust_url_decode("xxx%3"), "xxx");override(global, "decodeURIComponent", () => {throw new Error("foo");});assert.throws(() => {- util.robust_uri_decode("%E0%A4%A");+ util.robust_url_decode("%E0%A4%A");},{name: "Error", message: "foo"},);