mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 07:11:34 +08:00
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:
@ -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",
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user