Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
hash_util: Rename _uri functions to _url.
Austin Ribab22578f97517
diff --git a/frontend_tests/node_tests/compose_actions.js b/frontend_tests/node_tests/compose_actions.jsindex 975152b0c3a..90630c87bf5 100644--- a/frontend_tests/node_tests/compose_actions.js+++ b/frontend_tests/node_tests/compose_actions.js@@ -350,7 +350,7 @@ test("quote_and_reply", ({override, override_rewire}) => {sender_full_name: "Steve Stephenson",sender_id: 90,};- hash_util.by_conversation_and_time_uri = () =>+ hash_util.by_conversation_and_time_url = () =>"https://chat.zulip.org/#narrow/stream/92-learning/topic/Tornado";let success_function;diff --git a/frontend_tests/node_tests/compose_ui.js b/frontend_tests/node_tests/compose_ui.jsindex 37b01a56db1..1a5f357ce2e 100644--- a/frontend_tests/node_tests/compose_ui.js+++ b/frontend_tests/node_tests/compose_ui.js@@ -265,7 +265,7 @@ run_test("quote_and_reply", ({override, override_rewire}) => {override(hash_util,- "by_conversation_and_time_uri",+ "by_conversation_and_time_url",() => "https://chat.zulip.org/#narrow/stream/92-learning/topic/Tornado",);diff --git a/frontend_tests/node_tests/hash_util.js b/frontend_tests/node_tests/hash_util.jsindex ea82e90543d..807bb1da9fa 100644--- a/frontend_tests/node_tests/hash_util.js+++ b/frontend_tests/node_tests/hash_util.js@@ -129,15 +129,15 @@ run_test("test_parse_narrow", () => {]);});-run_test("test_stream_edit_uri", () => {+run_test("test_stream_edit_url", () => {const sub = {name: "research & development",stream_id: 42,};- assert.equal(hash_util.stream_edit_uri(sub), "#streams/42/research.20.26.20development");+ assert.equal(hash_util.stream_edit_url(sub), "#streams/42/research.20.26.20development");});-run_test("test_by_conversation_and_time_uri", () => {+run_test("test_by_conversation_and_time_url", () => {let message = {type: "stream",stream_id: frontend.stream_id,@@ -146,7 +146,7 @@ run_test("test_by_conversation_and_time_uri", () => {};assert.equal(- hash_util.by_conversation_and_time_uri(message),+ hash_util.by_conversation_and_time_url(message),"http://zulip.zulipdev.com/#narrow/stream/99-frontend/topic/testing/near/42",);@@ -161,7 +161,7 @@ run_test("test_by_conversation_and_time_uri", () => {};assert.equal(- hash_util.by_conversation_and_time_uri(message),+ hash_util.by_conversation_and_time_url(message),"http://zulip.zulipdev.com/#narrow/pm-with/15-pm/near/43",);});diff --git a/frontend_tests/node_tests/internal_url.js b/frontend_tests/node_tests/internal_url.jsindex 0eb70757ef8..8e1e0d4246a 100644--- a/frontend_tests/node_tests/internal_url.js+++ b/frontend_tests/node_tests/internal_url.js@@ -39,14 +39,14 @@ run_test("test encode_stream_id", () => {assert.equal(result, "123-stream-.28with-brackets.29");});-run_test("test by_stream_uri", () => {+run_test("test by_stream_url", () => {const maybe_get_stream_name = () => "a test stream";- const result = internal_url.by_stream_uri(123, maybe_get_stream_name);+ const result = internal_url.by_stream_url(123, maybe_get_stream_name);assert.equal(result, "#narrow/stream/123-a-test-stream");});-run_test("test by_stream_topic_uri", () => {+run_test("test by_stream_topic_url", () => {const maybe_get_stream_name = () => "a test stream";- const result = internal_url.by_stream_topic_uri(123, "test topic", maybe_get_stream_name);+ const result = internal_url.by_stream_topic_url(123, "test topic", maybe_get_stream_name);assert.equal(result, "#narrow/stream/123-a-test-stream/topic/test.20topic");});diff --git a/frontend_tests/node_tests/narrow.js b/frontend_tests/node_tests/narrow.jsindex ea91d2d658a..a2c75b9b7d0 100644--- a/frontend_tests/node_tests/narrow.js+++ b/frontend_tests/node_tests/narrow.js@@ -171,14 +171,14 @@ run_test("uris", () => {people.add_active_user(me);people.initialize_current_user(me.user_id);- let uri = hash_util.pm_with_uri(ray.email);- assert.equal(uri, "#narrow/pm-with/22-ray");+ let url = hash_util.pm_with_url(ray.email);+ assert.equal(url, "#narrow/pm-with/22-ray");- uri = hash_util.huddle_with_uri("22,23");- assert.equal(uri, "#narrow/pm-with/22,23-group");+ url = hash_util.huddle_with_url("22,23");+ assert.equal(url, "#narrow/pm-with/22,23-group");- uri = hash_util.by_sender_uri(ray.email);- assert.equal(uri, "#narrow/sender/22-ray");+ url = hash_util.by_sender_url(ray.email);+ assert.equal(url, "#narrow/sender/22-ray");let emails = hash_util.decode_operand("pm-with", "22,23-group");assert.equal(emails, "[email protected],[email protected]");diff --git a/frontend_tests/node_tests/popovers.js b/frontend_tests/node_tests/popovers.jsindex a8734c6d5b1..7a270457f53 100644--- a/frontend_tests/node_tests/popovers.js+++ b/frontend_tests/node_tests/popovers.js@@ -182,7 +182,7 @@ test_ui("sender_hover", ({override, mock_template}) => {user_circle_class: "user_circle_empty",user_last_seen_time_status:"translated: Last active: translated: More than 2 weeks ago",- pm_with_uri: "#narrow/pm-with/42-alice",+ pm_with_url: "#narrow/pm-with/42-alice",sent_by_uri: "#narrow/sender/42-alice",private_message_class: "respond_personal_button",show_email: false,diff --git a/frontend_tests/node_tests/recent_topics.js b/frontend_tests/node_tests/recent_topics.jsindex 79b01108c4e..b9b2a44056f 100644--- a/frontend_tests/node_tests/recent_topics.js+++ b/frontend_tests/node_tests/recent_topics.js@@ -76,9 +76,9 @@ mock_esm("../../static/js/compose_closed_ui", {update_buttons_for_recent_topics: noop,});mock_esm("../../static/js/hash_util", {- by_stream_uri: () => "https://www.example.com",+ by_stream_url: () => "https://www.example.com",- by_stream_topic_uri: () => "https://www.example.com",+ by_stream_topic_url: () => "https://www.example.com",});mock_esm("../../static/js/message_list_data", {MessageListData: class {},diff --git a/frontend_tests/node_tests/stream_settings_ui.js b/frontend_tests/node_tests/stream_settings_ui.jsindex 39bb4943834..ff99c0f6a33 100644--- a/frontend_tests/node_tests/stream_settings_ui.js+++ b/frontend_tests/node_tests/stream_settings_ui.js@@ -14,7 +14,7 @@ const ui = mock_esm("../../static/js/ui", {});mock_esm("../../static/js/hash_util", {- by_stream_uri: () => {},+ by_stream_url: () => {},get_current_hash_section: () => denmark_stream_id,});diff --git a/static/js/buddy_data.js b/static/js/buddy_data.jsindex ecfe1fa06cc..682275c2fd5 100644--- a/static/js/buddy_data.js+++ b/static/js/buddy_data.js@@ -181,7 +181,7 @@ export function info_for(user_id) {const user_circle_status = status_description(user_id);return {- href: hash_util.pm_with_uri(person.email),+ href: hash_util.pm_with_url(person.email),name: person.full_name,user_id,my_user_status,diff --git a/static/js/click_handlers.js b/static/js/click_handlers.jsindex 1d9d9112ee3..5d8116e428e 100644--- a/static/js/click_handlers.js+++ b/static/js/click_handlers.js@@ -244,7 +244,7 @@ export function initialize() {// so we re-encode the hash.const stream_id = Number.parseInt($(this).attr("data-stream-id"), 10);if (stream_id) {- browser_history.go_to_location(hash_util.by_stream_uri(stream_id));+ browser_history.go_to_location(hash_util.by_stream_url(stream_id));return;}window.location.href = $(this).attr("href");diff --git a/static/js/compose_actions.js b/static/js/compose_actions.jsindex 187b446f4f7..a54fd8dc6e6 100644--- a/static/js/compose_actions.js+++ b/static/js/compose_actions.js@@ -507,7 +507,7 @@ export function quote_and_reply(opts) {{defaultMessage: "{username} [said]({link_to_message}):"},{username: `@_**${message.sender_full_name}|${message.sender_id}**`,- link_to_message: `${hash_util.by_conversation_and_time_uri(message)}`,+ link_to_message: `${hash_util.by_conversation_and_time_url(message)}`,},);content += "\n";diff --git a/static/js/hash_util.js b/static/js/hash_util.jsindex b622582abf8..3977ab2e102 100644--- a/static/js/hash_util.js+++ b/static/js/hash_util.js@@ -76,14 +76,14 @@ export function decode_operand(operator, operand) {return operand;}-export function by_stream_uri(stream_id) {- // Wrapper for web use of internal_url.by_stream_uri- return internal_url.by_stream_uri(stream_id, stream_data.maybe_get_stream_name);+export function by_stream_url(stream_id) {+ // Wrapper for web use of internal_url.by_stream_url+ return internal_url.by_stream_url(stream_id, stream_data.maybe_get_stream_name);}-export function by_stream_topic_uri(stream_id, topic) {- // Wrapper for web use of internal_url.by_stream_topic_uri- return internal_url.by_stream_topic_uri(stream_id, topic, stream_data.maybe_get_stream_name);+export function by_stream_topic_url(stream_id, topic) {+ // Wrapper for web use of internal_url.by_stream_topic_url+ return internal_url.by_stream_topic_url(stream_id, topic, stream_data.maybe_get_stream_name);}// Encodes an operator list into the@@ -113,16 +113,16 @@ export function operators_to_hash(operators) {return hash;}-export function by_sender_uri(reply_to) {+export function by_sender_url(reply_to) {return operators_to_hash([{operator: "sender", operand: reply_to}]);}-export function pm_with_uri(reply_to) {+export function pm_with_url(reply_to) {const slug = people.emails_to_slug(reply_to);return "#narrow/pm-with/" + slug;}-export function huddle_with_uri(user_ids_string) {+export function huddle_with_url(user_ids_string) {// This method is convenient for callers// that have already converted emails to a comma-delimited// list of user_ids. We should be careful to keep this@@ -130,7 +130,7 @@ export function huddle_with_uri(user_ids_string) {return "#narrow/pm-with/" + user_ids_string + "-group";}-export function by_conversation_and_time_uri(message) {+export function by_conversation_and_time_url(message) {const absolute_url =window.location.protocol +"//" +@@ -141,13 +141,13 @@ export function by_conversation_and_time_uri(message) {const suffix = "/near/" + internal_url.encodeHashComponent(message.id);if (message.type === "stream") {- return absolute_url + by_stream_topic_uri(message.stream_id, message.topic) + suffix;+ return absolute_url + by_stream_topic_url(message.stream_id, message.topic) + suffix;}return absolute_url + people.pm_perma_link(message) + suffix;}-export function stream_edit_uri(sub) {+export function stream_edit_url(sub) {const hash = `#streams/${sub.stream_id}/${internal_url.encodeHashComponent(sub.name)}`;return hash;}diff --git a/static/js/markdown_config.js b/static/js/markdown_config.jsindex d4eb5998c8e..02dc48f1224 100644--- a/static/js/markdown_config.js+++ b/static/js/markdown_config.js@@ -40,8 +40,8 @@ export const get_helpers = () => ({// stream hashesget_stream_by_name: stream_data.get_sub,- stream_hash: hash_util.by_stream_uri,- stream_topic_hash: hash_util.by_stream_topic_uri,+ stream_hash: hash_util.by_stream_url,+ stream_topic_hash: hash_util.by_stream_topic_url,// settingsshould_translate_emoticons: () => user_settings.translate_emoticons,diff --git a/static/js/message_list_view.js b/static/js/message_list_view.jsindex 0f4957ca9f6..238ed679e72 100644--- a/static/js/message_list_view.js+++ b/static/js/message_list_view.js@@ -399,10 +399,10 @@ export class MessageListView {}if (message_container.msg.stream) {- message_container.stream_url = hash_util.by_stream_uri(+ message_container.stream_url = hash_util.by_stream_url(message_container.msg.stream_id,);- message_container.topic_url = hash_util.by_stream_topic_uri(+ message_container.topic_url = hash_util.by_stream_topic_url(message_container.msg.stream_id,message_container.msg.topic,);@@ -672,7 +672,7 @@ export class MessageListView {message.starred_status = $t({defaultMessage: "Star"});}- message.url = hash_util.by_conversation_and_time_uri(message);+ message.url = hash_util.by_conversation_and_time_url(message);return {msg: message};});diff --git a/static/js/notifications.js b/static/js/notifications.jsindex 9db139c57cf..35b6692cb93 100644--- a/static/js/notifications.js+++ b/static/js/notifications.js@@ -652,7 +652,7 @@ export function notify_local_mixes(messages, need_user_to_scroll) {function get_above_composebox_narrow_url(message) {let above_composebox_narrow_url;if (message.type === "stream") {- above_composebox_narrow_url = hash_util.by_stream_topic_uri(+ above_composebox_narrow_url = hash_util.by_stream_topic_url(message.stream_id,message.topic,);diff --git a/static/js/pm_list.js b/static/js/pm_list.jsindex 95eeea415bd..a3c1c0b922f 100644--- a/static/js/pm_list.js+++ b/static/js/pm_list.js@@ -97,7 +97,7 @@ export function _get_convos() {unread: num_unread,is_zero: num_unread === 0,is_active,- url: hash_util.pm_with_uri(reply_to),+ url: hash_util.pm_with_url(reply_to),status_emoji_info,user_circle_class,is_group,diff --git a/static/js/popovers.js b/static/js/popovers.jsindex 148e70ed657..abace1b9847 100644--- a/static/js/popovers.js+++ b/static/js/popovers.js@@ -225,10 +225,10 @@ function render_user_info_popover(is_bot: user.is_bot,is_me,is_sender_popover,- pm_with_uri: hash_util.pm_with_uri(user.email),+ 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_uri(user.email),+ sent_by_uri: hash_util.by_sender_url(user.email),show_email: settings_data.show_email(),show_user_profile: !user.is_bot,user_email: people.get_visible_email(user),@@ -504,7 +504,7 @@ export function toggle_actions_popover(element, id) {const should_display_quote_and_reply =message.content !== "<p>(deleted)</p>" && not_spectator;- const conversation_time_uri = hash_util.by_conversation_and_time_uri(message);+ const conversation_time_uri = hash_util.by_conversation_and_time_url(message);const should_display_delete_option =message_edit.get_deletability(message) && not_spectator;diff --git a/static/js/recent_topics_ui.js b/static/js/recent_topics_ui.jsindex c8b8406d557..acc3deff423 100644--- a/static/js/recent_topics_ui.js+++ b/static/js/recent_topics_ui.js@@ -303,13 +303,13 @@ function format_topic(topic_data) {stream_color: stream_info.color,invite_only: stream_info.invite_only,is_web_public: stream_info.is_web_public,- stream_url: hash_util.by_stream_uri(stream_id),+ stream_url: hash_util.by_stream_url(stream_id),topic,topic_key: get_topic_key(stream_id, topic),unread_count,last_msg_time,- topic_url: hash_util.by_stream_topic_uri(stream_id, topic),+ topic_url: hash_util.by_stream_topic_url(stream_id, topic),senders: senders_info,other_senders_count: Math.max(0, all_senders.length - MAX_AVATAR),other_sender_names_html,diff --git a/static/js/reminder.js b/static/js/reminder.jsindex fdcc67bfacf..2f62cd30174 100644--- a/static/js/reminder.js+++ b/static/js/reminder.js@@ -137,7 +137,7 @@ export function do_set_reminder_for_message(message_id, timestamp) {return;}- const link_to_msg = hash_util.by_conversation_and_time_uri(message);+ const link_to_msg = hash_util.by_conversation_and_time_url(message);const reminder_msg_content =message.raw_content + "\n\n[Link to conversation](" + link_to_msg + ")";let reminder_message = {diff --git a/static/js/stream_edit.js b/static/js/stream_edit.jsindex 8a4fc0946eb..17180d77504 100644--- a/static/js/stream_edit.js+++ b/static/js/stream_edit.js@@ -35,7 +35,7 @@ export let toggler;export let select_tab = "personal_settings";function setup_subscriptions_stream_hash(sub) {- const hash = hash_util.stream_edit_uri(sub);+ const hash = hash_util.stream_edit_url(sub);browser_history.update(hash);}diff --git a/static/js/stream_list.js b/static/js/stream_list.jsindex 85455712cc1..5115b4254ed 100644--- a/static/js/stream_list.js+++ b/static/js/stream_list.js@@ -243,7 +243,7 @@ function build_stream_sidebar_li(sub) {const args = {name,id: sub.stream_id,- uri: hash_util.by_stream_uri(sub.stream_id),+ uri: 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/static/js/stream_popover.js b/static/js/stream_popover.jsindex 407146e80aa..8f943ec3b1e 100644--- a/static/js/stream_popover.js+++ b/static/js/stream_popover.js@@ -567,7 +567,7 @@ export function register_stream_handlers() {const sub = stream_popover_sub(e);hide_stream_popover();- const stream_edit_hash = hash_util.stream_edit_uri(sub);+ const stream_edit_hash = hash_util.stream_edit_url(sub);browser_history.go_to_location(stream_edit_hash);});diff --git a/static/js/stream_settings_data.js b/static/js/stream_settings_data.jsindex 7a3a1f8d0ca..247386a7a24 100644--- a/static/js/stream_settings_data.js+++ b/static/js/stream_settings_data.js@@ -47,7 +47,7 @@ export function add_settings_fields(sub) {sub.can_access_subscribers = stream_data.can_view_subscribers(sub);sub.can_add_subscribers = stream_data.can_subscribe_others(sub);- sub.preview_url = hash_util.by_stream_uri(sub.stream_id);+ sub.preview_url = hash_util.by_stream_url(sub.stream_id);sub.is_old_stream = sub.stream_weekly_traffic !== null;}diff --git a/static/js/topic_list_data.js b/static/js/topic_list_data.jsindex 9bb5d0463b3..e6f39736a39 100644--- a/static/js/topic_list_data.js+++ b/static/js/topic_list_data.js@@ -103,7 +103,7 @@ export function get_list_info(stream_id, zoomed) {is_zero: num_unread === 0,is_muted: is_topic_muted,is_active_topic,- url: hash_util.by_stream_topic_uri(stream_id, topic_name),+ url: hash_util.by_stream_topic_url(stream_id, topic_name),resolved,resolved_topic_prefix: message_edit.RESOLVED_TOPIC_PREFIX,};diff --git a/static/js/user_profile.js b/static/js/user_profile.jsindex 81664b37f08..863382460d8 100644--- a/static/js/user_profile.js+++ b/static/js/user_profile.js@@ -43,7 +43,7 @@ function format_user_stream_list_item(stream, user) {is_web_public: stream.is_web_public,show_unsubscribe_button,show_private_stream_unsub_tooltip,- stream_edit_url: hash_util.stream_edit_uri(stream),+ stream_edit_url: hash_util.stream_edit_url(stream),});}@@ -278,7 +278,7 @@ export function register_click_handlers() {}if (sub.invite_only && people.is_my_user_id(target_user_id)) {- const new_hash = hash_util.stream_edit_uri(sub);+ const new_hash = hash_util.stream_edit_url(sub);hide_user_profile();browser_history.go_to_location(new_hash);return;diff --git a/static/shared/js/internal_url.js b/static/shared/js/internal_url.jsindex 35927dd60a9..5eeabdfc10c 100644--- a/static/shared/js/internal_url.js+++ b/static/shared/js/internal_url.js@@ -39,11 +39,11 @@ export function encode_stream_id(stream_id, maybe_get_stream_name) {return encodeHashComponent(slug);}-export function by_stream_uri(stream_id, maybe_get_stream_name) {+export function by_stream_url(stream_id, maybe_get_stream_name) {return "#narrow/stream/" + encode_stream_id(stream_id, maybe_get_stream_name);}-export function by_stream_topic_uri(stream_id, topic, maybe_get_stream_name) {+export function by_stream_topic_url(stream_id, topic, maybe_get_stream_name) {return ("#narrow/stream/" +encode_stream_id(stream_id, maybe_get_stream_name) +diff --git a/static/templates/user_info_popover_content.hbs b/static/templates/user_info_popover_content.hbsindex 9acb6ddc3a5..8e22a8c10cc 100644--- a/static/templates/user_info_popover_content.hbs+++ b/static/templates/user_info_popover_content.hbs@@ -151,7 +151,7 @@{{/if}}<hr /><li>- <a href="{{ pm_with_uri }}" class="narrow_to_private_messages">+ <a href="{{ pm_with_url }}" class="narrow_to_private_messages"><i class="fa fa-lock" aria-hidden="true"></i>{{#if is_me}}{{#tr}}View private messages to myself{{/tr}}