Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
urls: Generate narrow links in frontend with "channel" operator.
Lauryn Menardd3987f611c4c
diff --git a/web/e2e-tests/message-basics.test.ts b/web/e2e-tests/message-basics.test.tsindex 32629472094..7bcc1706706 100644--- a/web/e2e-tests/message-basics.test.ts+++ b/web/e2e-tests/message-basics.test.ts@@ -477,7 +477,7 @@ async function test_narrow_public_streams(page: Page): Promise<void> {);await page.click(".subscriptions-header .exit-sign");await page.waitForSelector("#subscription_overlay", {hidden: true});- await page.goto(`http://zulip.zulipdev.com:9981/#narrow/stream/${stream_id}-Denmark`);+ await page.goto(`http://zulip.zulipdev.com:9981/#narrow/channel/${stream_id}-Denmark`);let message_list_id = await common.get_current_msg_list_id(page, true);await page.waitForSelector(`.message-list[data-message-list-id='${message_list_id}'] .recipient_row ~ .recipient_row ~ .recipient_row`,@@ -488,7 +488,7 @@ async function test_narrow_public_streams(page: Page): Promise<void> {)) !== null,);- await page.goto("http://zulip.zulipdev.com:9981/#narrow/streams/public");+ await page.goto("http://zulip.zulipdev.com:9981/#narrow/channels/public");message_list_id = await common.get_current_msg_list_id(page, true);await page.waitForSelector(`.message-list[data-message-list-id='${message_list_id}'] .recipient_row ~ .recipient_row ~ .recipient_row`,diff --git a/web/shared/src/internal_url.ts b/web/shared/src/internal_url.tsindex d1d0cf978bd..dce0c68d62c 100644--- a/web/shared/src/internal_url.ts+++ b/web/shared/src/internal_url.ts@@ -54,7 +54,7 @@ export function by_stream_url(stream_id: number,maybe_get_stream_name: MaybeGetStreamName,): string {- return `#narrow/stream/${encode_stream_id(stream_id, maybe_get_stream_name)}`;+ return `#narrow/channel/${encode_stream_id(stream_id, maybe_get_stream_name)}`;}export function by_stream_topic_url(@@ -62,7 +62,7 @@ export function by_stream_topic_url(topic: string,maybe_get_stream_name: MaybeGetStreamName,): string {- return `#narrow/stream/${encode_stream_id(+ return `#narrow/channel/${encode_stream_id(stream_id,maybe_get_stream_name,)}/topic/${encodeHashComponent(topic)}`;diff --git a/web/src/filter.ts b/web/src/filter.tsindex addd20086ab..625866cf31f 100644--- a/web/src/filter.ts+++ b/web/src/filter.ts@@ -67,12 +67,6 @@ type ValidOrInvalidUser =| {valid_user: true; user_pill_context: UserPillItem}| {valid_user: false; operand: string};-// TODO: When "stream" is renamed to "channel", these placeholders-// should be removed, or replaced with helper functions similar-// to util.is_topic_synonym.-const CHANNEL_SYNONYM = "stream";-const CHANNELS_SYNONYM = "streams";-function zephyr_stream_name_match(message: Message & {type: "stream"},stream_name: string,@@ -143,7 +137,7 @@ function message_in_home(message: Message): boolean {}return (- // If stream is muted, we show the message if topic is unmuted or followed.+ // If channel is muted, we show the message if topic is unmuted or followed.!stream_data.is_muted(message.stream_id) ||user_topics.is_topic_unmuted_or_followed(message.stream_id, message.topic));@@ -324,11 +318,11 @@ export class Filter {return "topic";}- if (operator === CHANNEL_SYNONYM) {+ if (util.is_channel_synonym(operator)) {return "channel";}- if (operator === CHANNELS_SYNONYM) {+ if (util.is_channels_synonym(operator)) {return "channels";}return operator;@@ -513,7 +507,7 @@ export class Filter {// Check for user-entered channel name. If the name is valid,// convert it to id.if (- (operator === "stream" || operator === "channel") &&+ (operator === "channel" || util.is_channel_synonym(operator)) &&Number.isNaN(Number.parseInt(operand, 10))) {const sub = stream_data.get_sub(operand);@@ -825,7 +819,7 @@ export class Filter {};}// Assume the operand is a partially formed name and return- // the operator as the stream name in the next block.+ // the operator as the channel name in the next block.}return {type: "prefix_for_operator",@@ -860,7 +854,7 @@ export class Filter {}static adjusted_terms_if_moved(raw_terms: NarrowTerm[], message: Message): NarrowTerm[] | null {- // In case of narrow containing non-stream messages, we replace the+ // In case of narrow containing non-channel messages, we replace the// channel/topic/dm operators with singular dm operator corresponding// to the message if it contains `with` operator.if (message.type !== "stream") {@@ -1224,9 +1218,7 @@ export class Filter {return "#";}return (- "/#narrow/" +- CHANNEL_SYNONYM +- "/" ++ "/#narrow/channel/" +stream_data.id_to_slug(sub.stream_id) +"/topic/" +this.operands("topic")[0]@@ -1246,9 +1238,7 @@ export class Filter {if (!sub) {return "#";}- return (- "/#narrow/" + CHANNEL_SYNONYM + "/" + stream_data.id_to_slug(sub.stream_id)- );+ return "/#narrow/channel/" + stream_data.id_to_slug(sub.stream_id);}case "is-dm":return "/#narrow/is/dm";@@ -1257,7 +1247,7 @@ export class Filter {case "is-mentioned":return "/#narrow/is/mentioned";case "channels-public":- return "/#narrow/" + CHANNELS_SYNONYM + "/public";+ return "/#narrow/channels/public";case "dm":return "/#narrow/dm/" + people.emails_to_slug(this.operands("dm").join(","));case "is-resolved":diff --git a/web/src/hash_parser.ts b/web/src/hash_parser.tsindex 7b75f19f634..6e2193bee47 100644--- a/web/src/hash_parser.ts+++ b/web/src/hash_parser.ts@@ -36,11 +36,11 @@ export function get_current_hash_section(): string {export function is_same_server_message_link(url: string): boolean {// A same server message link always has category `narrow`,- // section `stream` or `dm`, and ends with `/near/<message_id>`,+ // section `channel` or `dm`, and ends with `/near/<message_id>`,// where <message_id> is a sequence of digits.return (get_hash_category(url) === "narrow" &&- (get_hash_section(url) === "stream" || get_hash_section(url) === "dm") &&+ (get_hash_section(url) === "channel" || get_hash_section(url) === "dm") &&get_nth_hash_section(url, -2) === "near" &&/^\d+$/.test(get_nth_hash_section(url, -1)));diff --git a/web/src/hash_util.ts b/web/src/hash_util.tsindex 39fc631a3d3..d3c6a0ff1a8 100644--- a/web/src/hash_util.ts+++ b/web/src/hash_util.ts@@ -35,7 +35,7 @@ export function encode_operand(operator: string, operand: string): string {}}- if (operator === "stream") {+ if (util.canonicalize_channel_synonyms(operator) === "channel") {const stream_id = Number.parseInt(operand, 10);return encode_stream_id(stream_id);}@@ -67,7 +67,7 @@ export function decode_operand(operator: string, operand: string): string {operand = internal_url.decodeHashComponent(operand);- if (util.canonicalize_stream_synonyms(operator) === "stream") {+ if (util.canonicalize_channel_synonyms(operator) === "channel") {return stream_data.slug_to_stream_id(operand)?.toString() ?? "";}@@ -97,7 +97,7 @@ export function search_terms_to_hash(terms?: NarrowTerm[]): string {for (const term of terms) {// Support legacy tuples.- const operator = util.canonicalize_stream_synonyms(term.operator);+ const operator = util.canonicalize_channel_synonyms(term.operator);const operand = term.operand;const sign = term.negated ? "-" : "";diff --git a/web/src/stream_settings_ui.js b/web/src/stream_settings_ui.jsindex 8684d83dda5..67bbe716405 100644--- a/web/src/stream_settings_ui.js+++ b/web/src/stream_settings_ui.js@@ -903,7 +903,7 @@ export function view_stream() {const row_data = get_row_data(active_data.$row);if (row_data) {const stream_narrow_hash =- "#narrow/stream/" + hash_util.encode_stream_id(row_data.object.stream_id);+ "#narrow/channel/" + hash_util.encode_stream_id(row_data.object.stream_id);browser_history.go_to_location(stream_narrow_hash);}}diff --git a/web/src/util.ts b/web/src/util.tsindex 769ebfe54ed..6e39640af18 100644--- a/web/src/util.ts+++ b/web/src/util.ts@@ -260,25 +260,20 @@ export function is_topic_synonym(operator: string): boolean {return operator === "subject";}-// TODO: When "stream" is renamed to "channel", update these stream-// synonym helper functions for the reverse logic.-export function is_stream_synonym(text: string): boolean {- return text === "channel";+export function is_channel_synonym(text: string): boolean {+ return text === "stream";}-export function is_streams_synonym(text: string): boolean {- return text === "channels";+export function is_channels_synonym(text: string): boolean {+ return text === "streams";}-// For parts of the codebase that have been converted to use-// channel/channels internally, this is used to convert those-// back into stream/streams for external presentation.-export function canonicalize_stream_synonyms(text: string): string {- if (is_stream_synonym(text.toLowerCase())) {- return "stream";+export function canonicalize_channel_synonyms(text: string): string {+ if (is_channel_synonym(text.toLowerCase())) {+ return "channel";}- if (is_streams_synonym(text.toLowerCase())) {- return "streams";+ if (is_channels_synonym(text.toLowerCase())) {+ return "channels";}return text;}diff --git a/web/tests/copy_and_paste.test.js b/web/tests/copy_and_paste.test.jsindex 6e5e5616003..449151bec78 100644--- a/web/tests/copy_and_paste.test.js+++ b/web/tests/copy_and_paste.test.js@@ -16,36 +16,36 @@ stream_data.add_sub({run_test("try_stream_topic_syntax_text", () => {const test_cases = [[- "http://zulip.zulipdev.com/#narrow/stream/4-Rome/topic/old.20FAILED.20EXPORT",+ "http://zulip.zulipdev.com/#narrow/channel/4-Rome/topic/old.20FAILED.20EXPORT","#**Rome>old FAILED EXPORT**",],[- "http://zulip.zulipdev.com/#narrow/stream/4-Rome/topic/100.25.20profits",+ "http://zulip.zulipdev.com/#narrow/channel/4-Rome/topic/100.25.20profits","#**Rome>100% profits**",],[- "http://zulip.zulipdev.com/#narrow/stream/4-Rome/topic/old.20API.20wasn't.20compiling.20erratically",+ "http://zulip.zulipdev.com/#narrow/channel/4-Rome/topic/old.20API.20wasn't.20compiling.20erratically","#**Rome>old API wasn't compiling erratically**",],- ["http://different.origin.com/#narrow/stream/4-Rome/topic/old.20FAILED.20EXPORT"],+ ["http://different.origin.com/#narrow/channel/4-Rome/topic/old.20FAILED.20EXPORT"],// malformed urls- ["http://zulip.zulipdev.com/narrow/stream/4-Rome/topic/old.20FAILED.20EXPORT"],- ["http://zulip.zulipdev.com/#not_narrow/stream/4-Rome/topic/old.20FAILED.20EXPORT"],+ ["http://zulip.zulipdev.com/narrow/channel/4-Rome/topic/old.20FAILED.20EXPORT"],+ ["http://zulip.zulipdev.com/#not_narrow/channel/4-Rome/topic/old.20FAILED.20EXPORT"],["http://zulip.zulipdev.com/#narrow/not_stream/4-Rome/topic/old.20FAILED.20EXPORT"],- ["http://zulip.zulipdev.com/#narrow/stream/4-Rome/not_topic/old.20FAILED.20EXPORT"],- ["http://zulip.zulipdev.com/#narrow/stream/4-Rome/topic/old.20FAILED.20EXPORT/near/100"],- ["http://zulip.zulipdev.com/#narrow/stream/4-Rome/", "#**Rome**"],- ["http://zulip.zulipdev.com/#narrow/stream/4-Rome/topic"],+ ["http://zulip.zulipdev.com/#narrow/channel/4-Rome/not_topic/old.20FAILED.20EXPORT"],+ ["http://zulip.zulipdev.com/#narrow/channel/4-Rome/topic/old.20FAILED.20EXPORT/near/100"],+ ["http://zulip.zulipdev.com/#narrow/channel/4-Rome/", "#**Rome**"],+ ["http://zulip.zulipdev.com/#narrow/channel/4-Rome/topic"],["http://zulip.zulipdev.com/#narrow/topic/cheese"],["http://zulip.zulipdev.com/#narrow/topic/pizza/stream/Rome"],// characters which are known to produce broken #**stream>topic** urls.- ["http://zulip.zulipdev.com/#narrow/stream/4-Rome/topic/100.25.20profits.60"],- ["http://zulip.zulipdev.com/#narrow/stream/4-Rome/topic/100.25.20*profits"],- ["http://zulip.zulipdev.com/#narrow/stream/4-Rome/topic/.24.24 100.25.20profits"],- ["http://zulip.zulipdev.com/#narrow/stream/4-Rome/topic/>100.25.20profits"],+ ["http://zulip.zulipdev.com/#narrow/channel/4-Rome/topic/100.25.20profits.60"],+ ["http://zulip.zulipdev.com/#narrow/channel/4-Rome/topic/100.25.20*profits"],+ ["http://zulip.zulipdev.com/#narrow/channel/4-Rome/topic/.24.24 100.25.20profits"],+ ["http://zulip.zulipdev.com/#narrow/channel/4-Rome/topic/>100.25.20profits"],];for (const test_case of test_cases) {diff --git a/web/tests/filter.test.js b/web/tests/filter.test.jsindex 440d1c58e72..afd0e8d8203 100644--- a/web/tests/filter.test.js+++ b/web/tests/filter.test.js@@ -2222,7 +2222,7 @@ test("navbar_helpers", ({override}) => {is_common_narrow: true,zulip_icon: "hashtag",title: "Foo",- redirect_url_with_search: `/#narrow/stream/${foo_stream_id}-Foo/topic/bar`,+ redirect_url_with_search: `/#narrow/channel/${foo_stream_id}-Foo/topic/bar`,},{terms: invalid_channel_with_topic,@@ -2236,14 +2236,14 @@ test("navbar_helpers", ({override}) => {is_common_narrow: true,icon: undefined,title: "translated: Messages in all public channels",- redirect_url_with_search: "/#narrow/streams/public",+ redirect_url_with_search: "/#narrow/channels/public",},{terms: channel_term,is_common_narrow: true,zulip_icon: "hashtag",title: "Foo",- redirect_url_with_search: `/#narrow/stream/${foo_stream_id}-Foo`,+ redirect_url_with_search: `/#narrow/channel/${foo_stream_id}-Foo`,},{terms: invalid_channel,@@ -2257,14 +2257,14 @@ test("navbar_helpers", ({override}) => {is_common_narrow: true,zulip_icon: "lock",title: "psub",- redirect_url_with_search: `/#narrow/stream/${public_sub_id}-psub`,+ redirect_url_with_search: `/#narrow/channel/${public_sub_id}-psub`,},{terms: web_public_channel,is_common_narrow: true,zulip_icon: "globe",title: "webPublicSub",- redirect_url_with_search: `/#narrow/stream/${web_public_sub_id}-webPublicSub`,+ redirect_url_with_search: `/#narrow/channel/${web_public_sub_id}-webPublicSub`,},{terms: dm,diff --git a/web/tests/hash_util.test.js b/web/tests/hash_util.test.jsindex 3aff0ffa196..b15b509ebe6 100644--- a/web/tests/hash_util.test.js+++ b/web/tests/hash_util.test.js@@ -213,7 +213,7 @@ run_test("test_by_conversation_and_time_url", () => {assert.equal(hash_util.by_conversation_and_time_url(message),- "http://zulip.zulipdev.com/#narrow/stream/99-frontend/topic/testing/near/42",+ "http://zulip.zulipdev.com/#narrow/channel/99-frontend/topic/testing/near/42",);message = {@@ -239,19 +239,19 @@ run_test("test_search_public_streams_notice_url", () => {assert.equal(hash_util.search_public_streams_notice_url(get_terms("#narrow/search/abc")),- "#narrow/streams/public/search/abc",+ "#narrow/channels/public/search/abc",);assert.equal(hash_util.search_public_streams_notice_url(get_terms("#narrow/has/link/has/image/has/attachment"),),- "#narrow/streams/public/has/link/has/image/has/attachment",+ "#narrow/channels/public/has/link/has/image/has/attachment",);assert.equal(hash_util.search_public_streams_notice_url(get_terms("#narrow/sender/15")),- "#narrow/streams/public/sender/15-Hamlet",+ "#narrow/channels/public/sender/15-Hamlet",);});diff --git a/web/tests/hashchange.test.js b/web/tests/hashchange.test.jsindex f823768cdf0..c8ab8ec0d89 100644--- a/web/tests/hashchange.test.js+++ b/web/tests/hashchange.test.js@@ -60,11 +60,11 @@ run_test("terms_round_trip", () => {{operator: "topic", operand: "algol"},];hash = hash_util.search_terms_to_hash(terms);- assert.equal(hash, "#narrow/stream/100-devel/topic/algol");+ assert.equal(hash, "#narrow/channel/100-devel/topic/algol");narrow = hash_util.parse_narrow(hash.split("/"));assert.deepEqual(narrow, [- {operator: "stream", operand: devel_id.toString(), negated: false},+ {operator: "channel", operand: devel_id.toString(), negated: false},{operator: "topic", operand: "algol", negated: false},]);@@ -73,11 +73,11 @@ run_test("terms_round_trip", () => {{operator: "topic", operand: "visual c++", negated: true},];hash = hash_util.search_terms_to_hash(terms);- assert.equal(hash, "#narrow/stream/100-devel/-topic/visual.20c.2B.2B");+ assert.equal(hash, "#narrow/channel/100-devel/-topic/visual.20c.2B.2B");narrow = hash_util.parse_narrow(hash.split("/"));assert.deepEqual(narrow, [- {operator: "stream", operand: devel_id.toString(), negated: false},+ {operator: "channel", operand: devel_id.toString(), negated: false},{operator: "topic", operand: "visual c++", negated: true},]);@@ -90,10 +90,10 @@ run_test("terms_round_trip", () => {stream_data.add_sub(florida_stream);terms = [{operator: "stream", operand: florida_id.toString()}];hash = hash_util.search_terms_to_hash(terms);- assert.equal(hash, "#narrow/stream/987-Florida.2C-USA");+ assert.equal(hash, "#narrow/channel/987-Florida.2C-USA");narrow = hash_util.parse_narrow(hash.split("/"));assert.deepEqual(narrow, [- {operator: "stream", operand: florida_id.toString(), negated: false},+ {operator: "channel", operand: florida_id.toString(), negated: false},]);});@@ -103,23 +103,23 @@ run_test("stream_to_channel_rename", () => {let narrow;let filter;- // Confirm the URLs generated from search terms use "stream" and "streams"- // and that the new Filter has the new "channel" and "channels" operators.- terms = [{operator: "channel", operand: devel_id.toString()}];+ // Confirm searches with "stream" and "streams" return URLs and+ // Filter objects with the new "channel" and "channels" operators.+ terms = [{operator: "stream", operand: devel_id.toString()}];hash = hash_util.search_terms_to_hash(terms);- assert.equal(hash, "#narrow/stream/100-devel");+ assert.equal(hash, "#narrow/channel/100-devel");narrow = hash_util.parse_narrow(hash.split("/"));- assert.deepEqual(narrow, [{operator: "stream", operand: devel_id.toString(), negated: false}]);+ assert.deepEqual(narrow, [{operator: "channel", operand: devel_id.toString(), negated: false}]);filter = new Filter(narrow);assert.deepEqual(filter.terms(), [{operator: "channel", operand: devel_id.toString(), negated: false},]);- terms = [{operator: "channels", operand: "public"}];+ terms = [{operator: "streams", operand: "public"}];hash = hash_util.search_terms_to_hash(terms);- assert.equal(hash, "#narrow/streams/public");+ assert.equal(hash, "#narrow/channels/public");narrow = hash_util.parse_narrow(hash.split("/"));- assert.deepEqual(narrow, [{operator: "streams", operand: "public", negated: false}]);+ assert.deepEqual(narrow, [{operator: "channels", operand: "public", negated: false}]);filter = new Filter(narrow);assert.deepEqual(filter.terms(), [{operator: "channels", operand: "public", negated: false}]);@@ -143,10 +143,10 @@ run_test("stream_to_channel_rename", () => {});run_test("terms_trailing_slash", () => {- const hash = "#narrow/stream/100-devel/topic/algol/";+ const hash = "#narrow/channel/100-devel/topic/algol/";const narrow = hash_util.parse_narrow(hash.split("/"));assert.deepEqual(narrow, [- {operator: "stream", operand: devel_id.toString(), negated: false},+ {operator: "channel", operand: devel_id.toString(), negated: false},{operator: "topic", operand: "algol", negated: false},]);});@@ -298,7 +298,7 @@ run_test("hash_interactions", ({override, override_rewire}) => {name: "Denmark",stream_id: denmark_id,});- window.location.hash = "#narrow/stream/Denmark";+ window.location.hash = "#narrow/channel/Denmark";helper.clear_events();$window_stub.trigger("hashchange");diff --git a/web/tests/i18n.test.js b/web/tests/i18n.test.jsindex f841648a0fd..481bc0f53ac 100644--- a/web/tests/i18n.test.js+++ b/web/tests/i18n.test.js@@ -74,7 +74,7 @@ run_test("t_tag", ({mock_template}) => {editability_menu_item: true,should_display_hide_option: true,conversation_time_url:- "http://zulip.zulipdev.com/#narrow/stream/101-devel/topic/testing/near/99",+ "http://zulip.zulipdev.com/#narrow/channel/101-devel/topic/testing/near/99",};mock_template("popovers/message_actions_popover.hbs", true, (data, html) => {diff --git a/web/tests/internal_url.test.js b/web/tests/internal_url.test.jsindex 1f4c5a639bf..7835857098f 100644--- a/web/tests/internal_url.test.js+++ b/web/tests/internal_url.test.js@@ -42,11 +42,11 @@ run_test("test encode_stream_id", () => {run_test("test by_stream_url", () => {const maybe_get_stream_name = () => "a test stream";const result = internal_url.by_stream_url(123, maybe_get_stream_name);- assert.equal(result, "#narrow/stream/123-a-test-stream");+ assert.equal(result, "#narrow/channel/123-a-test-stream");});run_test("test by_stream_topic_url", () => {const maybe_get_stream_name = () => "a test stream";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");+ assert.equal(result, "#narrow/channel/123-a-test-stream/topic/test.20topic");});diff --git a/web/tests/markdown.test.js b/web/tests/markdown.test.jsindex 34955836c20..1f5a87dd2cb 100644--- a/web/tests/markdown.test.js+++ b/web/tests/markdown.test.js@@ -393,12 +393,12 @@ test("marked", ({override}) => {{input: "This is a #**Denmark** stream link",expected:- '<p>This is a <a class="stream" data-stream-id="1" href="/#narrow/stream/1-Denmark">#Denmark</a> stream link</p>',+ '<p>This is a <a class="stream" data-stream-id="1" href="/#narrow/channel/1-Denmark">#Denmark</a> stream link</p>',},{input: "This is #**Denmark** and #**social** stream links",expected:- '<p>This is <a class="stream" data-stream-id="1" href="/#narrow/stream/1-Denmark">#Denmark</a> and <a class="stream" data-stream-id="2" href="/#narrow/stream/2-social">#social</a> stream links</p>',+ '<p>This is <a class="stream" data-stream-id="1" href="/#narrow/channel/1-Denmark">#Denmark</a> and <a class="stream" data-stream-id="2" href="/#narrow/channel/2-social">#social</a> stream links</p>',},{input: "And this is a #**wrong** stream link",@@ -407,12 +407,12 @@ test("marked", ({override}) => {{input: "This is a #**Denmark>some topic** stream_topic link",expected:- '<p>This is a <a class="stream-topic" data-stream-id="1" href="/#narrow/stream/1-Denmark/topic/some.20topic">#Denmark > some topic</a> stream_topic link</p>',+ '<p>This is a <a class="stream-topic" data-stream-id="1" href="/#narrow/channel/1-Denmark/topic/some.20topic">#Denmark > some topic</a> stream_topic link</p>',},{input: "This has two links: #**Denmark>some topic** and #**social>other topic**.",expected:- '<p>This has two links: <a class="stream-topic" data-stream-id="1" href="/#narrow/stream/1-Denmark/topic/some.20topic">#Denmark > some topic</a> and <a class="stream-topic" data-stream-id="2" href="/#narrow/stream/2-social/topic/other.20topic">#social > other topic</a>.</p>',+ '<p>This has two links: <a class="stream-topic" data-stream-id="1" href="/#narrow/channel/1-Denmark/topic/some.20topic">#Denmark > some topic</a> and <a class="stream-topic" data-stream-id="2" href="/#narrow/channel/2-social/topic/other.20topic">#social > other topic</a>.</p>',},{input: "This is not a #**Denmark>** stream_topic link",@@ -515,7 +515,7 @@ test("marked", ({override}) => {{input: "T\n#**Denmark**",expected:- '<p>T<br>\n<a class="stream" data-stream-id="1" href="/#narrow/stream/1-Denmark">#Denmark</a></p>',+ '<p>T<br>\n<a class="stream" data-stream-id="1" href="/#narrow/channel/1-Denmark">#Denmark</a></p>',},{input: "T\n@**Cordelia, Lear's daughter**",@@ -622,17 +622,17 @@ test("marked", ({override}) => {{input: "#**Bobby <h1>Tables</h1>**",expected:- '<p><a class="stream-topic" data-stream-id="4" href="/#narrow/stream/4-Bobby-.3Ch1/topic/Tables.3C.2Fh1.3E">#Bobby <h1 > Tables</h1></a></p>',+ '<p><a class="stream-topic" data-stream-id="4" href="/#narrow/channel/4-Bobby-.3Ch1/topic/Tables.3C.2Fh1.3E">#Bobby <h1 > Tables</h1></a></p>',},{input: "#**& & &amp;**",expected:- '<p><a class="stream" data-stream-id="5" href="/#narrow/stream/5-.26-.26-.26amp.3B">#& & &amp;</a></p>',+ '<p><a class="stream" data-stream-id="5" href="/#narrow/channel/5-.26-.26-.26amp.3B">#& & &amp;</a></p>',},{input: "#**& & &amp;>& & &amp;**",expected:- '<p><a class="stream-topic" data-stream-id="5" href="/#narrow/stream/5-.26-.26-.26amp.3B/topic/.26.20.26.20.26amp.3B">#& & &amp; > & & &amp;</a></p>',+ '<p><a class="stream-topic" data-stream-id="5" href="/#narrow/channel/5-.26-.26-.26amp.3B/topic/.26.20.26.20.26amp.3B">#& & &amp; > & & &amp;</a></p>',},];diff --git a/web/tests/stream_list.test.js b/web/tests/stream_list.test.jsindex afa394a1e69..0d77fbc0495 100644--- a/web/tests/stream_list.test.js+++ b/web/tests/stream_list.test.js@@ -71,7 +71,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.url, "#narrow/stream/100-devel");+ assert.equal(data.url, "#narrow/channel/100-devel");return "<devel-sidebar-row-stub>";});@@ -94,7 +94,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.url, "#narrow/stream/200-social");+ assert.equal(data.url, "#narrow/channel/200-social");return "<social-sidebar-row-stub>";});@@ -666,7 +666,7 @@ test_ui("rename_stream", ({mock_template, override}) => {assert.deepEqual(payload, {name: "Development",id: 1000,- url: "#narrow/stream/1000-Development",+ url: "#narrow/channel/1000-Development",is_muted: undefined,invite_only: undefined,is_web_public: undefined,diff --git a/web/tests/topic_link_util.test.js b/web/tests/topic_link_util.test.jsindex 99a947df233..905e5db0c3d 100644--- a/web/tests/topic_link_util.test.js+++ b/web/tests/topic_link_util.test.js@@ -47,40 +47,40 @@ run_test("stream_topic_link_syntax_test", () => {);assert.equal(topic_link_util.get_stream_topic_link_syntax("#**Sweden>t", "test `test` test"),- "[#Sweden>test `test` test](#narrow/stream/1-Sweden/topic/test.20.60test.60.20test)",+ "[#Sweden>test `test` test](#narrow/channel/1-Sweden/topic/test.20.60test.60.20test)",);assert.equal(topic_link_util.get_stream_topic_link_syntax("#**Denmark>t", "test `test` test`s"),- "[#Denmark>test `test` test`s](#narrow/stream/2-Denmark/topic/test.20.60test.60.20test.60s)",+ "[#Denmark>test `test` test`s](#narrow/channel/2-Denmark/topic/test.20.60test.60.20test.60s)",);assert.equal(topic_link_util.get_stream_topic_link_syntax("#**Sweden>typeah", "error due to *"),- "[#Sweden>error due to *](#narrow/stream/1-Sweden/topic/error.20due.20to.20*)",+ "[#Sweden>error due to *](#narrow/channel/1-Sweden/topic/error.20due.20to.20*)",);assert.equal(topic_link_util.get_stream_topic_link_syntax("#**Sweden>t", "*asterisk"),- "[#Sweden>*asterisk](#narrow/stream/1-Sweden/topic/*asterisk)",+ "[#Sweden>*asterisk](#narrow/channel/1-Sweden/topic/*asterisk)",);assert.equal(topic_link_util.get_stream_topic_link_syntax("#**Sweden>gibberish", "greaterthan>"),- "[#Sweden>greaterthan>](#narrow/stream/1-Sweden/topic/greaterthan.3E)",+ "[#Sweden>greaterthan>](#narrow/channel/1-Sweden/topic/greaterthan.3E)",);assert.equal(topic_link_util.get_stream_topic_link_syntax("#**$$MONEY$$>t", "dollar"),- "[#$$MONEY$$>dollar](#narrow/stream/6-.24.24MONEY.24.24/topic/dollar)",+ "[#$$MONEY$$>dollar](#narrow/channel/6-.24.24MONEY.24.24/topic/dollar)",);assert.equal(topic_link_util.get_stream_topic_link_syntax("#**Sweden>t", "swe$$dish"),- "[#Sweden>swe$$dish](#narrow/stream/1-Sweden/topic/swe.24.24dish)",+ "[#Sweden>swe$$dish](#narrow/channel/1-Sweden/topic/swe.24.24dish)",);assert.equal(topic_link_util.get_fallback_markdown_link("Sweden"),- "[#Sweden](#narrow/stream/1-Sweden)",+ "[#Sweden](#narrow/channel/1-Sweden)",);assert.equal(topic_link_util.get_fallback_markdown_link("$$MONEY$$"),- "[#$$MONEY$$](#narrow/stream/6-.24.24MONEY.24.24)",+ "[#$$MONEY$$](#narrow/channel/6-.24.24MONEY.24.24)",);// Only for full coverage of the module.diff --git a/web/tests/topic_list_data.test.js b/web/tests/topic_list_data.test.jsindex 04d19253f04..0f5702e0f55 100644--- a/web/tests/topic_list_data.test.js+++ b/web/tests/topic_list_data.test.js@@ -109,7 +109,7 @@ test("get_list_info w/real stream_topic_history", ({override}) => {is_followed: false,is_unmuted_or_followed: false,is_active_topic: true,- url: "#narrow/stream/556-general/topic/topic.2011",+ url: "#narrow/channel/556-general/topic/topic.2011",contains_unread_mention: false,});@@ -133,7 +133,7 @@ test("get_list_info w/real stream_topic_history", ({override}) => {topic_name: "✔ topic 9",topic_resolved_prefix: "✔ ",unread: 0,- url: "#narrow/stream/556-general/topic/.E2.9C.94.20topic.209",+ url: "#narrow/channel/556-general/topic/.E2.9C.94.20topic.209",});assert.deepEqual(list_info.items[1], {@@ -148,7 +148,7 @@ test("get_list_info w/real stream_topic_history", ({override}) => {topic_name: "topic 8",topic_resolved_prefix: "",unread: 0,- url: "#narrow/stream/556-general/topic/topic.208",+ url: "#narrow/channel/556-general/topic/topic.208",});// If we zoom in, our results are based on topic filter.