Skip to content

Commit db6034f

Browse files
ClearlyClairehiyuki2578
authored andcommitted
Fix serialization of boosts (mastodon#10129)
The condition introduced by mastodon#9998 was wrong, serializing boosts that weren't self-boosts, and not serializing self-boosts.
1 parent 92dd2e1 commit db6034f

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

app/serializers/activitypub/activity_serializer.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
class ActivityPub::ActivitySerializer < ActiveModel::Serializer
44
attributes :id, :type, :actor, :published, :to, :cc
55

6-
has_one :proper, key: :object, serializer: ActivityPub::NoteSerializer, unless: :owned_announce?
7-
attribute :proper_uri, key: :object, if: :owned_announce?
6+
has_one :proper, key: :object, serializer: ActivityPub::NoteSerializer, if: :serialize_object?
7+
attribute :proper_uri, key: :object, unless: :serialize_object?
88
attribute :atom_uri, if: :announce?
99

1010
def id
@@ -43,7 +43,9 @@ def announce?
4343
object.reblog?
4444
end
4545

46-
def owned_announce?
47-
announce? && object.account == object.proper.account && object.proper.private_visibility?
46+
def serialize_object?
47+
return true unless announce?
48+
# Serialize private self-boosts of local toots
49+
object.account == object.proper.account && object.proper.private_visibility? && object.local?
4850
end
4951
end

0 commit comments

Comments
 (0)