mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-12 23:38:20 +00:00
17 lines
446 B
Ruby
17 lines
446 B
Ruby
# frozen_string_literal: true
|
|
|
|
class REST::BaseCollectionSerializer < ActiveModel::Serializer
|
|
attributes :id, :uri, :name, :description, :local, :sensitive,
|
|
:discoverable, :item_count, :created_at, :updated_at
|
|
|
|
belongs_to :tag, serializer: REST::StatusSerializer::TagSerializer
|
|
|
|
def id
|
|
object.id.to_s
|
|
end
|
|
|
|
def item_count
|
|
object.respond_to?(:item_count) ? object.item_count : object.collection_items.count
|
|
end
|
|
end
|