discourse/app/serializers/about_serializer.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
805 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2014-08-12 04:59:00 +08:00
class AboutSerializer < ApplicationSerializer
class UserAboutSerializer < BasicUserSerializer
attributes :title, :last_seen_at
end
class AboutCategoryModsSerializer < ApplicationSerializer
attributes :category_id
has_many :moderators, serializer: UserAboutSerializer, embed: :objects
end
has_many :moderators, serializer: UserAboutSerializer, embed: :objects
has_many :admins, serializer: UserAboutSerializer, embed: :objects
has_many :category_moderators, serializer: AboutCategoryModsSerializer, embed: :objects
2014-08-12 04:59:00 +08:00
2014-08-12 06:15:35 +08:00
attributes :stats,
:description,
:title,
:locale,
:version,
:https
2015-07-07 12:52:19 +08:00
def stats
object.class.fetch_cached_stats || Jobs::AboutStats.new.execute({})
end
2014-08-12 04:59:00 +08:00
end