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:
Martin Brennan
2022-12-13 09:14:17 +10:00
committed by GitHub
parent de53cf7657
commit 3ee4b59c64
11 changed files with 24 additions and 25 deletions

View File

@ -195,7 +195,7 @@ class Chat::ChatNotifier
potential_participants, unreachable =
users.partition do |user|
guardian = Guardian.new(user)
guardian.can_chat?(user) && guardian.can_see_chat_channel?(@chat_channel)
guardian.can_chat? && guardian.can_see_chat_channel?(@chat_channel)
end
participants, welcome_to_join =