update_serializer.rb 479 B

1234567891011121314151617181920212223
  1. # frozen_string_literal: true
  2. class ActivityPub::UpdateSerializer < ActivityPub::Serializer
  3. attributes :id, :type, :actor, :to
  4. has_one :object, serializer: ActivityPub::ActorSerializer
  5. def id
  6. [ActivityPub::TagManager.instance.uri_for(object), '#updates/', object.updated_at.to_i].join
  7. end
  8. def type
  9. 'Update'
  10. end
  11. def actor
  12. ActivityPub::TagManager.instance.uri_for(object)
  13. end
  14. def to
  15. [ActivityPub::TagManager::COLLECTIONS[:public]]
  16. end
  17. end