emoji_serializer.rb 481 B

12345678910111213141516171819202122232425262728293031
  1. # frozen_string_literal: true
  2. class ActivityPub::EmojiSerializer < ActivityPub::Serializer
  3. include RoutingHelper
  4. context_extensions :emoji
  5. attributes :id, :type, :name, :updated
  6. has_one :icon, serializer: ActivityPub::ImageSerializer
  7. def id
  8. ActivityPub::TagManager.instance.uri_for(object)
  9. end
  10. def type
  11. 'Emoji'
  12. end
  13. def icon
  14. object.image
  15. end
  16. def updated
  17. object.updated_at.iso8601
  18. end
  19. def name
  20. ":#{object.shortcode}:"
  21. end
  22. end