Fix serialization of boosts (#10129)
The condition introduced by #9998 was wrong, serializing boosts that weren't self-boosts, and not serializing self-boosts.
This commit is contained in:
parent
3a3cdc9724
commit
2d9138082e
1 changed files with 6 additions and 4 deletions
|
@ -3,8 +3,8 @@
|
||||||
class ActivityPub::ActivitySerializer < ActiveModel::Serializer
|
class ActivityPub::ActivitySerializer < ActiveModel::Serializer
|
||||||
attributes :id, :type, :actor, :published, :to, :cc
|
attributes :id, :type, :actor, :published, :to, :cc
|
||||||
|
|
||||||
has_one :proper, key: :object, serializer: ActivityPub::NoteSerializer, unless: :owned_announce?
|
has_one :proper, key: :object, serializer: ActivityPub::NoteSerializer, if: :serialize_object?
|
||||||
attribute :proper_uri, key: :object, if: :owned_announce?
|
attribute :proper_uri, key: :object, unless: :serialize_object?
|
||||||
attribute :atom_uri, if: :announce?
|
attribute :atom_uri, if: :announce?
|
||||||
|
|
||||||
def id
|
def id
|
||||||
|
@ -43,7 +43,9 @@ class ActivityPub::ActivitySerializer < ActiveModel::Serializer
|
||||||
object.reblog?
|
object.reblog?
|
||||||
end
|
end
|
||||||
|
|
||||||
def owned_announce?
|
def serialize_object?
|
||||||
announce? && object.account == object.proper.account && object.proper.private_visibility?
|
return true unless announce?
|
||||||
|
# Serialize private self-boosts of local toots
|
||||||
|
object.account == object.proper.account && object.proper.private_visibility? && object.local?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue