mirror of
https://github.com/discourse/discourse.git
synced 2024-12-15 20:16:17 +08:00
17 lines
381 B
Ruby
17 lines
381 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
module UserStatusMixin
|
||
|
def self.included(klass)
|
||
|
klass.attributes :status
|
||
|
end
|
||
|
|
||
|
def include_status?
|
||
|
@options[:include_status] && SiteSetting.enable_user_status &&
|
||
|
!object.user_option&.hide_profile_and_presence && object.has_status?
|
||
|
end
|
||
|
|
||
|
def status
|
||
|
UserStatusSerializer.new(object.user_status, root: false).as_json
|
||
|
end
|
||
|
end
|