gearheads
/
mastodon
Archived
2
0
Fork 0
This repository has been archived on 2024-06-09. You can view files and clone it, but cannot push or open issues/pull-requests.
mastodon/app/serializers/rest/announcement_serializer.rb

35 lines
751 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class REST::AnnouncementSerializer < ActiveModel::Serializer
attributes :id, :content, :starts_at, :ends_at, :all_day
has_many :mentions
has_many :tags, serializer: REST::StatusSerializer::TagSerializer
has_many :emojis, serializer: REST::CustomEmojiSerializer
has_many :reactions, serializer: REST::ReactionSerializer
def id
object.id.to_s
end
def content
Formatter.instance.linkify(object.text)
end
def reactions
object.reactions(current_user&.account)
end
class AccountSerializer < ActiveModel::Serializer
attributes :id, :username, :url, :acct
def id
object.id.to_s
end
def url
ActivityPub::TagManager.instance.url_for(object)
end
end
end