mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
message_send: Fix checking permission to send DMs.
This commit fixes the code to add a check for whether the setting is set to an anonymous group or not before checking if the setting is set to "Nobody" group by checking the group name.
This commit is contained in:
@@ -1565,7 +1565,8 @@ def check_can_send_direct_message(
|
||||
user_ids = [recipient_user.id for recipient_user in recipient_users] + [sender.id]
|
||||
if not is_any_user_in_group(direct_message_permission_group, user_ids):
|
||||
is_nobody_group = (
|
||||
direct_message_permission_group.named_user_group.name == SystemGroups.NOBODY
|
||||
hasattr(direct_message_permission_group, "named_user_group")
|
||||
and direct_message_permission_group.named_user_group.name == SystemGroups.NOBODY
|
||||
)
|
||||
raise DirectMessagePermissionError(is_nobody_group)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user