mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-09 17:15:18 +00:00
Change /api/v1/announcements
to return regular Status
entities (#26736)
This commit is contained in:
parent
9ae2594726
commit
fc89ecc6ca
|
@ -59,10 +59,12 @@ class Announcement < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def statuses
|
def statuses
|
||||||
@statuses ||= if status_ids.nil?
|
@statuses ||= begin
|
||||||
|
if status_ids.nil?
|
||||||
[]
|
[]
|
||||||
else
|
else
|
||||||
Status.where(id: status_ids).distributable_visibility
|
Status.with_includes.distributable_visibility.where(id: status_ids)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ class REST::AnnouncementSerializer < ActiveModel::Serializer
|
||||||
attribute :read, if: :current_user?
|
attribute :read, if: :current_user?
|
||||||
|
|
||||||
has_many :mentions
|
has_many :mentions
|
||||||
has_many :statuses
|
has_many :statuses, serializer: REST::StatusSerializer
|
||||||
has_many :tags, serializer: REST::StatusSerializer::TagSerializer
|
has_many :tags, serializer: REST::StatusSerializer::TagSerializer
|
||||||
has_many :emojis, serializer: REST::CustomEmojiSerializer
|
has_many :emojis, serializer: REST::CustomEmojiSerializer
|
||||||
has_many :reactions, serializer: REST::ReactionSerializer
|
has_many :reactions, serializer: REST::ReactionSerializer
|
||||||
|
@ -49,16 +49,4 @@ class REST::AnnouncementSerializer < ActiveModel::Serializer
|
||||||
object.pretty_acct
|
object.pretty_acct
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class StatusSerializer < ActiveModel::Serializer
|
|
||||||
attributes :id, :url
|
|
||||||
|
|
||||||
def id
|
|
||||||
object.id.to_s
|
|
||||||
end
|
|
||||||
|
|
||||||
def url
|
|
||||||
ActivityPub::TagManager.instance.url_for(object)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue