mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 01:15:00 +08:00
3ee4b59c64
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.
14 lines
277 B
Ruby
14 lines
277 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Chat::Api < Chat::ChatBaseController
|
|
before_action :ensure_logged_in
|
|
before_action :ensure_can_chat
|
|
|
|
private
|
|
|
|
def ensure_can_chat
|
|
raise Discourse::NotFound unless SiteSetting.chat_enabled
|
|
guardian.ensure_can_chat!
|
|
end
|
|
end
|