Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
minor: Convert `find_mentions` to uppercase.
akshatdalton0a01b1b28ee4
diff --git a/zerver/lib/markdown/__init__.py b/zerver/lib/markdown/__init__.pyindex 8baf0bc2aef..d217cf5c96b 100644--- a/zerver/lib/markdown/__init__.py+++ b/zerver/lib/markdown/__init__.py@@ -1683,7 +1683,7 @@ class BlockQuoteProcessor(markdown.blockprocessors.BlockQuoteProcessor):# Original regex for blockquote is RE = re.compile(r'(^|\n)[ ]{0,3}>[ ]?(.*)')RE = re.compile(r"(^|\n)(?!(?:[ ]{0,3}>\s*(?:$|\n))*(?:$|\n))" r"[ ]{0,3}>[ ]?(.*)")- mention_re = re.compile(mention.find_mentions)+ mention_re = re.compile(mention.MENTIONS_RE)# run() is very slightly forked from the base class; see notes below.def run(self, parent: Element, blocks: List[str]) -> None:@@ -2223,7 +2223,7 @@ class Markdown(markdown.Markdown):reg.register(markdown.inlinepatterns.DoubleTagPattern(STRONG_EM_RE, "strong,em"), "strong_em", 100)- reg.register(UserMentionPattern(mention.find_mentions, self), "usermention", 95)+ reg.register(UserMentionPattern(mention.MENTIONS_RE, self), "usermention", 95)reg.register(Tex(r"\B(?<!\$)\$\$(?P<body>[^\n_$](\\\$|[^$\n])*)\$\$(?!\$)\B", self), "tex", 90)diff --git a/zerver/lib/mention.py b/zerver/lib/mention.pyindex 476e49a1aba..42c48e4dc07 100644--- a/zerver/lib/mention.py+++ b/zerver/lib/mention.py@@ -3,7 +3,7 @@ from typing import Optional, Set, Tuple# Match multi-word string between @** ** or match any one-word# sequences after @-find_mentions = r"(?<![^\s\'\"\(,:<])@(?P<silent>_?)(?P<match>\*\*[^\*]+\*\*|all|everyone|stream)"+MENTIONS_RE = r"(?<![^\s\'\"\(,:<])@(?P<silent>_?)(?P<match>\*\*[^\*]+\*\*|all|everyone|stream)"user_group_mentions = r"(?<![^\s\'\"\(,:<])@(\*[^\*]+\*)"wildcards = ["all", "everyone", "stream"]@@ -26,7 +26,7 @@ def extract_mention_text(m: Tuple[str, str]) -> Tuple[Optional[str], bool]:def possible_mentions(content: str) -> Tuple[Set[str], bool]:- matches = re.findall(find_mentions, content)+ matches = re.findall(MENTIONS_RE, content)# mention texts can either be names, or an extended name|id syntax.texts = set()message_has_wildcards = False