Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
topic_link_util: Make stream topic link syntax consistent.
Kislay Udbhav Vermafad7a3f4b419
diff --git a/web/src/topic_link_util.ts b/web/src/topic_link_util.tsindex 320f36e6893..5a83414bbe5 100644--- a/web/src/topic_link_util.ts+++ b/web/src/topic_link_util.ts@@ -43,7 +43,7 @@ export function get_fallback_markdown_link(stream_name: string, topic_name?: strassert(stream_id !== undefined);const escape = html_escape_markdown_syntax_characters;if (topic_name !== undefined) {- return `[#${escape(stream_name)}>${escape(topic_name)}](${internal_url.by_stream_topic_url(stream_id, topic_name, () => stream_name)})`;+ return `[#${escape(stream_name)} > ${escape(topic_name)}](${internal_url.by_stream_topic_url(stream_id, topic_name, () => stream_name)})`;}return `[#${escape(stream_name)}](${internal_url.by_stream_url(stream_id, () => stream_name)})`;}diff --git a/web/tests/copy_and_paste.test.js b/web/tests/copy_and_paste.test.jsindex 98674b0aaf1..7252bf735ea 100644--- a/web/tests/copy_and_paste.test.js+++ b/web/tests/copy_and_paste.test.js@@ -49,23 +49,23 @@ run_test("try_stream_topic_syntax_text", () => {// #**stream>topic** urls is pasted, a normal markdown link syntax is produced.["http://zulip.zulipdev.com/#narrow/stream/4-Rome/topic/100.25.20profits.60",- "[#Rome>100% profits`](#narrow/channel/4-Rome/topic/100.25.20profits.60)",+ "[#Rome > 100% profits`](#narrow/channel/4-Rome/topic/100.25.20profits.60)",],["http://zulip.zulipdev.com/#narrow/stream/4-Rome/topic/100.25.20*profits",- "[#Rome>100% *profits](#narrow/channel/4-Rome/topic/100.25.20*profits)",+ "[#Rome > 100% *profits](#narrow/channel/4-Rome/topic/100.25.20*profits)",],["http://zulip.zulipdev.com/#narrow/stream/4-Rome/topic/.24.24 100.25.20profits",- "[#Rome>$$ 100% profits](#narrow/channel/4-Rome/topic/.24.24.20100.25.20profits)",+ "[#Rome > $$ 100% profits](#narrow/channel/4-Rome/topic/.24.24.20100.25.20profits)",],["http://zulip.zulipdev.com/#narrow/stream/4-Rome/topic/>100.25.20profits",- "[#Rome>>100% profits](#narrow/channel/4-Rome/topic/.3E100.25.20profits)",+ "[#Rome > >100% profits](#narrow/channel/4-Rome/topic/.3E100.25.20profits)",],["http://zulip.zulipdev.com/#narrow/stream/5-Romeo.60s-lair/topic/normal",- "[#Romeo`s lair>normal](#narrow/channel/5-Romeo.60s-lair/topic/normal)",+ "[#Romeo`s lair > normal](#narrow/channel/5-Romeo.60s-lair/topic/normal)",],];diff --git a/web/tests/topic_link_util.test.js b/web/tests/topic_link_util.test.jsindex d1ba594390a..c28df753430 100644--- a/web/tests/topic_link_util.test.js+++ b/web/tests/topic_link_util.test.js@@ -47,31 +47,31 @@ 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/channel/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/channel/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/channel/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/channel/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/channel/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/channel/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/channel/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"),@@ -85,7 +85,7 @@ run_test("stream_topic_link_syntax_test", () => {assert.equal(topic_link_util.get_stream_topic_link_syntax("#**Sweden>&ab", "&ab"),- "[#Sweden>&ab](#narrow/channel/1-Sweden/topic/.26ab)",+ "[#Sweden > &ab](#narrow/channel/1-Sweden/topic/.26ab)",);// Only for full coverage of the module.