2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2014-08-11 16:59:00 -04:00
|
|
|
class AboutSerializer < ApplicationSerializer
|
2019-01-15 06:55:22 -05:00
|
|
|
class UserAboutSerializer < BasicUserSerializer
|
|
|
|
attributes :title, :last_seen_at
|
|
|
|
end
|
|
|
|
|
2019-07-31 09:46:58 -04:00
|
|
|
class AboutCategoryModsSerializer < ApplicationSerializer
|
|
|
|
attributes :category_id
|
|
|
|
|
|
|
|
has_many :moderators, serializer: UserAboutSerializer, embed: :objects
|
|
|
|
end
|
|
|
|
|
2019-01-15 06:55:22 -05:00
|
|
|
has_many :moderators, serializer: UserAboutSerializer, embed: :objects
|
|
|
|
has_many :admins, serializer: UserAboutSerializer, embed: :objects
|
2019-07-31 09:46:58 -04:00
|
|
|
has_many :category_moderators, serializer: AboutCategoryModsSerializer, embed: :objects
|
2014-08-11 16:59:00 -04:00
|
|
|
|
2014-08-11 18:15:35 -04:00
|
|
|
attributes :stats,
|
|
|
|
:description,
|
|
|
|
:title,
|
|
|
|
:locale,
|
2014-11-24 01:54:17 -05:00
|
|
|
:version,
|
2020-05-23 00:56:13 -04:00
|
|
|
:https,
|
2021-05-19 02:15:24 -04:00
|
|
|
:can_see_about_stats,
|
|
|
|
:contact_url,
|
|
|
|
:contact_email
|
2020-05-23 00:56:13 -04:00
|
|
|
|
|
|
|
def include_stats?
|
|
|
|
can_see_about_stats
|
|
|
|
end
|
2015-07-07 00:52:19 -04:00
|
|
|
|
|
|
|
def stats
|
2023-11-09 15:44:05 -05:00
|
|
|
object.class.fetch_cached_stats
|
2015-07-07 00:52:19 -04:00
|
|
|
end
|
2021-05-19 02:15:24 -04:00
|
|
|
|
|
|
|
def include_contact_url?
|
|
|
|
can_see_site_contact_details
|
|
|
|
end
|
|
|
|
|
|
|
|
def contact_url
|
|
|
|
SiteSetting.contact_url
|
|
|
|
end
|
|
|
|
|
|
|
|
def include_contact_email?
|
|
|
|
can_see_site_contact_details
|
|
|
|
end
|
|
|
|
|
|
|
|
def contact_email
|
|
|
|
SiteSetting.contact_email
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def can_see_about_stats
|
|
|
|
scope.can_see_about_stats?
|
|
|
|
end
|
|
|
|
|
|
|
|
def can_see_site_contact_details
|
|
|
|
scope.can_see_site_contact_details?
|
|
|
|
end
|
2014-08-11 16:59:00 -04:00
|
|
|
end
|