mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
message: Optimize checking if mentioning user group is allowed.
This commit updates the code to not call is_user_in_group function if can_mention_group setting is set to "role:everyone" group.
This commit is contained in:
@@ -1220,12 +1220,12 @@ def check_user_group_mention_allowed(sender: UserProfile, user_group_ids: List[i
|
|||||||
|
|
||||||
for group in user_groups:
|
for group in user_groups:
|
||||||
can_mention_group = group.can_mention_group
|
can_mention_group = group.can_mention_group
|
||||||
|
if (
|
||||||
|
hasattr(can_mention_group, "named_user_group")
|
||||||
|
and can_mention_group.named_user_group.name == SystemGroups.EVERYONE
|
||||||
|
):
|
||||||
|
continue
|
||||||
if sender_is_system_bot:
|
if sender_is_system_bot:
|
||||||
if (
|
|
||||||
hasattr(can_mention_group, "named_user_group")
|
|
||||||
and can_mention_group.named_user_group.name == SystemGroups.EVERYONE
|
|
||||||
):
|
|
||||||
continue
|
|
||||||
raise JsonableError(
|
raise JsonableError(
|
||||||
_("You are not allowed to mention user group '{user_group_name}'.").format(
|
_("You are not allowed to mention user group '{user_group_name}'.").format(
|
||||||
user_group_name=group.name
|
user_group_name=group.name
|
||||||
|
|||||||
Reference in New Issue
Block a user