follow_serializer.rb 486 B

12345678910111213141516171819202122
  1. # frozen_string_literal: true
  2. class ActivityPub::FollowSerializer < ActiveModel::Serializer
  3. attributes :id, :type, :actor
  4. attribute :virtual_object, key: :object
  5. def id
  6. [ActivityPub::TagManager.instance.uri_for(object.account), '#follows/', object.id].join
  7. end
  8. def type
  9. 'Follow'
  10. end
  11. def actor
  12. ActivityPub::TagManager.instance.uri_for(object.account)
  13. end
  14. def virtual_object
  15. ActivityPub::TagManager.instance.uri_for(object.target_account)
  16. end
  17. end