Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
mention: Replace 'wildcard' with 'stream_wildcard'.
Prakhar Pratyush2b42df4ef1b8
diff --git a/web/src/markdown.js b/web/src/markdown.jsindex 110944ad55d..86d3447b7ad 100644--- a/web/src/markdown.js+++ b/web/src/markdown.js@@ -117,7 +117,7 @@ function parse_with_options({raw_content, helper_config, options}) {classes = "user-mention silent";display_text = mention;} else {- // Wildcard mention+ // Stream Wildcard mentionmentioned_wildcard = true;display_text = "@" + mention;classes = "user-mention";diff --git a/web/tests/markdown.test.js b/web/tests/markdown.test.jsindex fcd6580208f..93902eb5127 100644--- a/web/tests/markdown.test.js+++ b/web/tests/markdown.test.js@@ -406,19 +406,19 @@ test("marked", () => {'<blockquote>\n<p>Mention in quote: <span class="user-mention silent" data-user-id="101">Cordelia, Lear's daughter</span></p>\n</blockquote>\n<p>Mention outside quote: <span class="user-mention" data-user-id="101">@Cordelia, Lear's daughter</span></p>',},{- input: "Wildcard mention: @**all**\nWildcard silent mention: @_**all**",+ input: "Stream Wildcard mention: @**all**\nStream Wildcard silent mention: @_**all**",expected:- '<p>Wildcard mention: <span class="user-mention" data-user-id="*">@all</span><br>\nWildcard silent mention: <span class="user-mention silent" data-user-id="*">all</span></p>',+ '<p>Stream Wildcard mention: <span class="user-mention" data-user-id="*">@all</span><br>\nStream Wildcard silent mention: <span class="user-mention silent" data-user-id="*">all</span></p>',},{- input: "> Wildcard mention in quote: @**all**\n\n> Another wildcard mention in quote: @_**all**",+ input: "> Stream Wildcard mention in quote: @**all**\n\n> Another stream wildcard mention in quote: @_**all**",expected:- '<blockquote>\n<p>Wildcard mention in quote: <span class="user-mention silent" data-user-id="*">all</span></p>\n</blockquote>\n<blockquote>\n<p>Another wildcard mention in quote: <span class="user-mention silent" data-user-id="*">all</span></p>\n</blockquote>',+ '<blockquote>\n<p>Stream Wildcard mention in quote: <span class="user-mention silent" data-user-id="*">all</span></p>\n</blockquote>\n<blockquote>\n<p>Another stream wildcard mention in quote: <span class="user-mention silent" data-user-id="*">all</span></p>\n</blockquote>',},{- input: "```quote\nWildcard mention in quote: @**all**\n```\n\n```quote\nAnother wildcard mention in quote: @_**all**\n```",+ input: "```quote\nStream Wildcard mention in quote: @**all**\n```\n\n```quote\nAnother stream wildcard mention in quote: @_**all**\n```",expected:- '<blockquote>\n<p>Wildcard mention in quote: <span class="user-mention silent" data-user-id="*">all</span></p>\n</blockquote>\n<blockquote>\n<p>Another wildcard mention in quote: <span class="user-mention silent" data-user-id="*">all</span></p>\n</blockquote>',+ '<blockquote>\n<p>Stream Wildcard mention in quote: <span class="user-mention silent" data-user-id="*">all</span></p>\n</blockquote>\n<blockquote>\n<p>Another stream wildcard mention in quote: <span class="user-mention silent" data-user-id="*">all</span></p>\n</blockquote>',},{input: "User group mention: @*backend*\nUser group silent mention: @_*hamletcharacters*",diff --git a/zerver/tests/test_markdown.py b/zerver/tests/test_markdown.pyindex 491b2ac4eb3..c0c7bed781a 100644--- a/zerver/tests/test_markdown.py+++ b/zerver/tests/test_markdown.py@@ -50,6 +50,7 @@ from zerver.lib.mention import (get_possible_mentions_info,possible_mentions,possible_user_group_mentions,+ stream_wildcards,)from zerver.lib.message import render_markdownfrom zerver.lib.test_classes import ZulipTestCase@@ -1966,12 +1967,11 @@ class MarkdownTest(ZulipTestCase):)self.assertEqual(rendering_result.mentions_user_ids, set())- def test_silent_wildcard_mention(self) -> None:+ def test_silent_stream_wildcard_mention(self) -> None:user_profile = self.example_user("othello")msg = Message(sender=user_profile, sending_client=get_client("test"))- wildcards = ["all", "everyone", "stream"]- for wildcard in wildcards:+ for wildcard in stream_wildcards:content = f"@_**{wildcard}**"rendering_result = render_markdown(msg, content)self.assertEqual(@@ -2132,7 +2132,7 @@ class MarkdownTest(ZulipTestCase):self.assertEqual(rendering_result.rendered_content, expected)self.assertEqual(rendering_result.mentions_user_ids, set())- def test_wildcard_mention_in_quotes(self) -> None:+ def test_stream_wildcard_mention_in_quotes(self) -> None:user_profile = self.example_user("othello")message = Message(sender=user_profile, sending_client=get_client("test"))@@ -2146,8 +2146,7 @@ class MarkdownTest(ZulipTestCase):self.assertEqual(rendering_result.rendered_content, expected)self.assertFalse(rendering_result.mentions_stream_wildcard)- wildcards = ["all", "everyone", "stream"]- for wildcard in wildcards:+ for wildcard in stream_wildcards:assert_silent_mention(f"> @**{wildcard}**", wildcard)assert_silent_mention(f"> @_**{wildcard}**", wildcard)assert_silent_mention(f"```quote\n@**{wildcard}**\n```", wildcard)