diff --git a/frontend_tests/node_tests/compose_actions.js b/frontend_tests/node_tests/compose_actions.js index 975152b0c3..90630c87bf 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.js index 37b01a56db..1a5f357ce2 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.js index ea82e90543..807bb1da9f 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.js index 0eb70757ef..8e1e0d4246 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.js index ea91d2d658..a2c75b9b7d 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, "alice@example.com,ray@example.com"); diff --git a/frontend_tests/node_tests/popovers.js b/frontend_tests/node_tests/popovers.js index a8734c6d5b..7a270457f5 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.js index 79b01108c4..b9b2a44056 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.js index 39bb494383..ff99c0f6a3 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.js index ecfe1fa06c..682275c2fd 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.js index 1d9d9112ee..5d8116e428 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.js index 187b446f4f..a54fd8dc6e 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.js index b622582abf..3977ab2e10 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.js index d4eb5998c8..02dc48f122 100644 --- a/static/js/markdown_config.js +++ b/static/js/markdown_config.js @@ -40,8 +40,8 @@ export const get_helpers = () => ({ // stream hashes get_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, // settings should_translate_emoticons: () => user_settings.translate_emoticons, diff --git a/static/js/message_list_view.js b/static/js/message_list_view.js index 0f4957ca9f..238ed679e7 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.js index 9db139c57c..35b6692cb9 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.js index 95eeea415b..a3c1c0b922 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.js index 148e70ed65..abace1b984 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 !== "
(deleted)
" && 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.js index c8b8406d55..acc3deff42 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.js index fdcc67bfac..2f62cd3017 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.js index 8a4fc0946e..17180d7750 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.js index 85455712cc..5115b4254e 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.js index 407146e80a..8f943ec3b1 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.js index 7a3a1f8d0c..247386a7a2 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.js index 9bb5d0463b..e6f39736a3 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.js index 81664b37f0..863382460d 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.js index 35927dd60a..5eeabdfc10 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.hbs index 9acb6ddc3a..8e22a8c10c 100644 --- a/static/templates/user_info_popover_content.hbs +++ b/static/templates/user_info_popover_content.hbs @@ -151,7 +151,7 @@ {{/if}}