Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

hash_util: Parse with operators for copy/paste.

Tim Abbott42bc59b8027a
diff --git a/web/src/hash_util.ts b/web/src/hash_util.ts
index 28bb15b2db6..3940bd07601 100644
--- a/web/src/hash_util.ts
+++ b/web/src/hash_util.ts
@@ -332,6 +332,10 @@ export function decode_stream_topic_from_url(
if (terms.length === 2) {
return {stream_id, topic_name: terms[1].operand};
}
+ if (terms[2]?.operator === "with") {
+ // For with operators, we currently discard the message ID.
+ return {stream_id, topic_name: terms[1].operand};
+ }
if (terms[2]?.operator !== "near") {
return null;
}
diff --git a/web/tests/copy_and_paste.test.cjs b/web/tests/copy_and_paste.test.cjs
index 67aba3fcc7d..35aff25d1c0 100644
--- a/web/tests/copy_and_paste.test.cjs
+++ b/web/tests/copy_and_paste.test.cjs
@@ -45,6 +45,10 @@ run_test("try_stream_topic_syntax_text", () => {
"#**Rome>old FAILED EXPORT@100**",
],
["http://zulip.zulipdev.com/#narrow/channel/4-Rome/topic//near/100", "#**Rome>@100**"],
+ [
+ "http://zulip.zulipdev.com/#narrow/channel/4-Rome/topic/old.20FAILED.20EXPORT/with/100",
+ "#**Rome>old FAILED EXPORT**",
+ ],
// malformed urls
["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"],