logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

emoji_serializer.rb (452B)


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