Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
hash-util: Rename stream_edit_url to channels_settings_edit_url.
Lauryn Menardee84b277ec9f
diff --git a/web/src/buddy_list.ts b/web/src/buddy_list.tsindex 84b5eef0fa9..1786c8c0b45 100644--- a/web/src/buddy_list.ts+++ b/web/src/buddy_list.ts@@ -475,7 +475,10 @@ export class BuddyList extends BuddyListConf {stream_data.can_view_subscribers(current_sub) &&has_inactive_users_matching_view) {- const stream_edit_hash = hash_util.stream_edit_url(current_sub, "subscribers");+ const stream_edit_hash = hash_util.channels_settings_edit_url(+ current_sub,+ "subscribers",+ );$("#buddy-list-users-matching-view-container").append($(render_view_all_subscribers({diff --git a/web/src/hash_util.ts b/web/src/hash_util.tsindex af259373a3e..a2fd3bc2ce2 100644--- a/web/src/hash_util.ts+++ b/web/src/hash_util.ts@@ -144,12 +144,6 @@ export function by_conversation_and_time_url(message: Message): string {return absolute_url + people.pm_perma_link(message) + suffix;}-export function stream_edit_url(sub: StreamSubscription, right_side_tab: string): string {- return `#channels/${sub.stream_id}/${internal_url.encodeHashComponent(- sub.name,- )}/${right_side_tab}`;-}-export function group_edit_url(group: UserGroup, right_side_tab: string): string {const hash = `#groups/${group.id}/${internal_url.encodeHashComponent(group.name)}/${right_side_tab}`;return hash;@@ -192,6 +186,15 @@ export function parse_narrow(hash: string): NarrowTerm[] | undefined {return terms;}+export function channels_settings_edit_url(+ sub: StreamSubscription,+ right_side_tab: string,+): string {+ return `#channels/${sub.stream_id}/${internal_url.encodeHashComponent(+ sub.name,+ )}/${right_side_tab}`;+}+export function channels_settings_section_url(section = "subscribed"): string {const valid_section_values = new Set(["new", "subscribed", "all"]);if (!valid_section_values.has(section)) {@@ -233,7 +236,7 @@ export function validate_channels_settings_hash(hash: string): string {if (!valid_right_side_tab_values.has(right_side_tab)) {right_side_tab = "general";}- return stream_edit_url(sub, right_side_tab);+ return channels_settings_edit_url(sub, right_side_tab);}return channels_settings_section_url(section);diff --git a/web/src/message_view_header.ts b/web/src/message_view_header.tsindex 86f93818be1..9d1e2632b7a 100644--- a/web/src/message_view_header.ts+++ b/web/src/message_view_header.ts@@ -82,7 +82,7 @@ function get_message_view_header_context(filter: Filter | undefined): MessageVierendered_narrow_description: current_stream.rendered_description,sub_count,stream: current_stream,- stream_settings_link: hash_util.stream_edit_url(current_stream, "general"),+ stream_settings_link: hash_util.channels_settings_edit_url(current_stream, "general"),};}return icon_data;diff --git a/web/src/stream_edit_toggler.ts b/web/src/stream_edit_toggler.tsindex ccf5a145a81..8e35a2b337f 100644--- a/web/src/stream_edit_toggler.ts+++ b/web/src/stream_edit_toggler.ts@@ -29,7 +29,7 @@ export function setup_toggler(): void {const stream_id = Number.parseInt($stream_header.attr("data-stream-id") ?? "", 10);const sub = sub_store.get(stream_id);if (sub) {- const hash = hash_util.stream_edit_url(sub, select_tab);+ const hash = hash_util.channels_settings_edit_url(sub, select_tab);browser_history.update(hash);}},diff --git a/web/src/stream_popover.js b/web/src/stream_popover.jsindex 5a45f3999a4..d15d5ff3d69 100644--- a/web/src/stream_popover.js+++ b/web/src/stream_popover.js@@ -121,7 +121,7 @@ function build_stream_popover(opts) {const sub = stream_popover_sub(e);hide_stream_popover();- const stream_edit_hash = hash_util.stream_edit_url(sub, "general");+ const stream_edit_hash = hash_util.channels_settings_edit_url(sub, "general");browser_history.go_to_location(stream_edit_hash);});diff --git a/web/src/user_profile.js b/web/src/user_profile.jsindex bb3bfa92189..921c917a975 100644--- a/web/src/user_profile.js+++ b/web/src/user_profile.js@@ -196,7 +196,7 @@ function format_user_stream_list_item_html(stream, user) {show_unsubscribe_button,show_private_stream_unsub_tooltip,show_last_user_in_private_stream_unsub_tooltip,- stream_edit_url: hash_util.stream_edit_url(stream, "general"),+ stream_edit_url: hash_util.channels_settings_edit_url(stream, "general"),});}@@ -927,7 +927,7 @@ export function initialize() {(people.is_my_user_id(target_user_id) ||peer_data.get_subscriber_count(stream_id) === 1)) {- const new_hash = hash_util.stream_edit_url(sub, "general");+ const new_hash = hash_util.channels_settings_edit_url(sub, "general");hide_user_profile();browser_history.go_to_location(new_hash);return;diff --git a/web/tests/hash_util.test.js b/web/tests/hash_util.test.jsindex 33459fe6558..ae0ec5eb0d4 100644--- a/web/tests/hash_util.test.js+++ b/web/tests/hash_util.test.js@@ -196,13 +196,13 @@ run_test("test_parse_narrow", () => {]);});-run_test("test_stream_edit_url", () => {+run_test("test_channels_settings_edit_url", () => {const sub = {name: "research & development",stream_id: 42,};assert.equal(- hash_util.stream_edit_url(sub, "general"),+ hash_util.channels_settings_edit_url(sub, "general"),"#channels/42/research.20.26.20development/general",);});