mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 23:49:34 +08:00
DEV: Use guardian user for can_chat? (#19418)
Instead of passing `user` to `guardian.can_chat?`, we can just use the inner `@user` that is part of the guardian instance already to determine whether that user can chat, since this is how it works for all other usages of guardian even within chat.
This commit is contained in:
@ -10,10 +10,9 @@ module Chat::GuardianExtensions
|
||||
end
|
||||
end
|
||||
|
||||
def can_chat?(user)
|
||||
return false unless user
|
||||
|
||||
user.staff? || user.in_any_groups?(Chat.allowed_group_ids)
|
||||
def can_chat?
|
||||
return false if anonymous?
|
||||
@user.staff? || @user.in_any_groups?(Chat.allowed_group_ids)
|
||||
end
|
||||
|
||||
def can_create_chat_message?
|
||||
|
Reference in New Issue
Block a user