0
0
Fork 0

Better pagination for ActivityPub outbox (#7356)

This commit is contained in:
Eugen Rochko 2018-05-04 19:19:11 +02:00 committed by GitHub
parent d181aad033
commit 2c1f7b2ece
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 50 additions and 12 deletions

View file

@ -7,12 +7,14 @@ class ActivityPub::CollectionSerializer < ActiveModel::Serializer
super
end
attributes :id, :type, :total_items
attributes :id, :type
attribute :total_items, if: -> { object.size.present? }
attribute :next, if: -> { object.next.present? }
attribute :prev, if: -> { object.prev.present? }
attribute :part_of, if: -> { object.part_of.present? }
has_one :first, if: -> { object.first.present? }
has_one :last, if: -> { object.last.present? }
has_many :items, key: :items, if: -> { (!object.items.nil? || page?) && !ordered? }
has_many :items, key: :ordered_items, if: -> { (!object.items.nil? || page?) && ordered? }