FIX: correctly shows as disabled a user who can't chat (#26010)

Prior to this fix we were checking if user was not part of a group which allows to chat, but we were not checking if this user was part of groups who can use direct messages.
This commit is contained in:
Joffrey JAFFEUX
2024-03-05 09:13:42 +01:00
committed by GitHub
parent 00e76efb7c
commit 27407a25b4
7 changed files with 49 additions and 9 deletions

View File

@ -199,7 +199,7 @@ module Chat
.where(id: scoped_channels)
.includes(
last_message: [:uploads],
chatable: [{ direct_message_users: [user: :user_option] }, :users],
chatable: [{ direct_message_users: [user: %i[user_option group_users]] }, :users],
)
.joins(
"LEFT JOIN chat_messages last_message ON last_message.id = chat_channels.last_message_id",

View File

@ -25,7 +25,7 @@ module Chat
end
def can_create_direct_message?
is_staff? || @user.in_any_groups?(SiteSetting.direct_message_enabled_groups_map)
is_staff? || can_direct_message?
end
def hidden_tag_names