mention: Allow silent mentioning system user groups.

Previously, we do not allow mentioning system user groups
at all. Now we want to use silent mention syntax for system
groups in the message sent when updating the posting permission
for a stream, so it is important to allowing silent mentioning
system groups at least. And there is no problem in allowing
silent mentions of system groups for all users.

We do not allow mentioning system groups as can_mention_group
for them is set to "Nobody" group.
This commit is contained in:
Sahil Batra
2024-12-20 14:33:43 +05:30
committed by Tim Abbott
parent aa8f47774f
commit fa099f7ce7
6 changed files with 56 additions and 24 deletions

View File

@@ -51,6 +51,7 @@ from zerver.lib.mention import (
FullNameInfo,
MentionBackend,
MentionData,
get_user_group_mention_display_name,
)
from zerver.lib.outgoing_http import OutgoingSession
from zerver.lib.subdomains import is_static_or_current_realm_url
@@ -1989,7 +1990,7 @@ class UserGroupMentionPattern(CompiledInlineProcessor):
if not silent:
self.zmd.zulip_rendering_result.mentions_user_group_ids.add(user_group.id)
name = user_group.name
name = get_user_group_mention_display_name(user_group)
user_group_id = str(user_group.id)
else:
# Don't highlight @-mentions that don't refer to a valid user