mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-21 05:54:19 +08:00
15 lines
368 B
Ruby
Vendored
15 lines
368 B
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
module Chat
|
|
class ChatableUserSerializer < UserWithCustomFieldsSerializer
|
|
attributes :can_chat, :has_chat_enabled
|
|
|
|
def can_chat
|
|
SiteSetting.chat_enabled && object.guardian.can_chat? && scope.can_create_direct_message?
|
|
end
|
|
|
|
def has_chat_enabled
|
|
can_chat && object.user_option&.chat_enabled
|
|
end
|
|
end
|
|
end
|