copy_and_paste: Fix missing empty string topic in message_link syntax.

Earlier, pasting a message_link for a message in empty string topic in
the compose area resulted in #**channel_name@100** syntax instead of the
correct #**channel_name>@100** syntax.

This commit fixes that bug.
This commit is contained in:
Prakhar Pratyush
2025-01-29 12:05:29 +05:30
committed by Tim Abbott
parent e08bf15682
commit 53dc5198c6
2 changed files with 2 additions and 1 deletions

View File

@@ -928,7 +928,7 @@ export function try_stream_topic_syntax_text(text: string): string | null {
} }
let syntax_text = "#**" + stream_name; let syntax_text = "#**" + stream_name;
if (stream_topic.topic_name) { if (stream_topic.topic_name !== undefined) {
syntax_text += ">" + stream_topic.topic_name; syntax_text += ">" + stream_topic.topic_name;
} }

View File

@@ -44,6 +44,7 @@ run_test("try_stream_topic_syntax_text", () => {
"http://zulip.zulipdev.com/#narrow/channel/4-Rome/topic/old.20FAILED.20EXPORT/near/100", "http://zulip.zulipdev.com/#narrow/channel/4-Rome/topic/old.20FAILED.20EXPORT/near/100",
"#**Rome>old FAILED EXPORT@100**", "#**Rome>old FAILED EXPORT@100**",
], ],
["http://zulip.zulipdev.com/#narrow/channel/4-Rome/topic//near/100", "#**Rome>@100**"],
// malformed urls // malformed urls
["http://zulip.zulipdev.com/narrow/channel/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/#not_narrow/channel/4-Rome/topic/old.20FAILED.20EXPORT"],