about summary refs log tree commit diff
path: root/app/serializers
diff options
context:
space:
mode:
authorJenkins <jenkins@jenkins.ninjawedding.org>2018-05-04 18:17:32 +0000
committerJenkins <jenkins@jenkins.ninjawedding.org>2018-05-04 18:17:32 +0000
commitcb62935c0b00f41ff5d4ab77a8cc38174b05d186 (patch)
tree52714c8f33e66dcf6ff09957fb2e6d3d103c6fcb /app/serializers
parentb316d373ea5c239ab373a43a5c75abec8d5fc4aa (diff)
parent2c1f7b2ece96c724f6230352974d4282ac51dfd5 (diff)
Merge remote-tracking branch 'tootsuite/master' into glitchsoc/master
Diffstat (limited to 'app/serializers')
-rw-r--r--app/serializers/activitypub/collection_serializer.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/serializers/activitypub/collection_serializer.rb b/app/serializers/activitypub/collection_serializer.rb
index 1ae492945..e8960131b 100644
--- a/app/serializers/activitypub/collection_serializer.rb
+++ b/app/serializers/activitypub/collection_serializer.rb
@@ -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? }