Skip to content

Commit

Permalink
Do not misattribute inlined boosts if attributedTo isn't present (m…
Browse files Browse the repository at this point in the history
…astodon#10967)

* Do not misattribute inlined boosts if `attributedTo` isn't present

Fixes mastodon#10950

* Fix tests
  • Loading branch information
ClearlyClaire authored and hiyuki2578 committed Oct 2, 2019
1 parent 352a10a commit 524f80d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
2 changes: 1 addition & 1 deletion app/lib/activitypub/activity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def status_from_object

# If the boosted toot is embedded and it is a self-boost, handle it like a Create
unless unsupported_object_type?
actor_id = value_or_id(first_of_value(@object['attributedTo'])) || @account.uri
actor_id = value_or_id(first_of_value(@object['attributedTo']))

if actor_id == @account.uri
return ActivityPub::Activity.factory({ 'type' => 'Create', 'actor' => actor_id, 'object' => @object }, @account).perform
Expand Down
18 changes: 3 additions & 15 deletions spec/lib/activitypub/activity/announce_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,6 @@
end
end

context 'self-boost of a previously unknown status with missing attributedTo' do
let(:object_json) do
{
id: 'https://example.com/actor#bar',
type: 'Note',
content: 'Lorem ipsum',
to: 'http://example.com/followers',
}
end

it 'creates a reblog by sender of status' do
expect(sender.reblogged?(sender.statuses.first)).to be true
end
end

context 'self-boost of a previously unknown status with correct attributedTo' do
let(:object_json) do
{
Expand Down Expand Up @@ -122,6 +107,7 @@
type: 'Note',
content: 'Lorem ipsum',
to: 'http://example.com/followers',
attributedTo: 'https://example.com/actor',
}
end

Expand All @@ -141,6 +127,7 @@
type: 'Note',
content: 'Lorem ipsum',
to: 'http://example.com/followers',
attributedTo: 'https://example.com/actor',
}
end

Expand All @@ -161,6 +148,7 @@
type: 'Note',
content: 'Lorem ipsum',
to: 'http://example.com/followers',
attributedTo: 'https://example.com/actor',
}
end

Expand Down

0 comments on commit 524f80d

Please sign in to comment.