The code powering m.abunchtell.com https://m.abunchtell.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

35 lines
751 B

  1. # frozen_string_literal: true
  2. class REST::AnnouncementSerializer < ActiveModel::Serializer
  3. attributes :id, :content, :starts_at, :ends_at, :all_day
  4. has_many :mentions
  5. has_many :tags, serializer: REST::StatusSerializer::TagSerializer
  6. has_many :emojis, serializer: REST::CustomEmojiSerializer
  7. has_many :reactions, serializer: REST::ReactionSerializer
  8. def id
  9. object.id.to_s
  10. end
  11. def content
  12. Formatter.instance.linkify(object.text)
  13. end
  14. def reactions
  15. object.reactions(current_user&.account)
  16. end
  17. class AccountSerializer < ActiveModel::Serializer
  18. attributes :id, :username, :url, :acct
  19. def id
  20. object.id.to_s
  21. end
  22. def url
  23. ActivityPub::TagManager.instance.url_for(object)
  24. end
  25. end
  26. end