markdown: Add support for user group silent mention.

Prior to this, we only supported direct mention to
the user groups. This commit extends that support
to silent mention for the user groups.
A related test case is also added.

Fixes: #11711.
This commit is contained in:
akshatdalton
2021-05-16 07:43:47 +00:00
committed by Tim Abbott
parent f56fca308a
commit 0245b590e9
3 changed files with 26 additions and 4 deletions

View File

@@ -4,7 +4,7 @@ from typing import Match, Optional, Set, Tuple
# Match multi-word string between @** ** or match any one-word
# sequences after @
MENTIONS_RE = re.compile(r"(?<![^\s\'\"\(,:<])@(?P<silent>_?)(\*\*(?P<match>[^\*]+)\*\*)")
USER_GROUP_MENTIONS_RE = re.compile(r"(?<![^\s\'\"\(,:<])@(\*(?P<match>[^\*]+)\*)")
USER_GROUP_MENTIONS_RE = re.compile(r"(?<![^\s\'\"\(,:<])@(?P<silent>_?)(\*(?P<match>[^\*]+)\*)")
wildcards = ["all", "everyone", "stream"]