mirror of
https://github.com/glitch-soc/mastodon.git
synced 2026-03-29 03:00:33 +02:00
Use to_json call for AP::Follow reject path (#38227)
This commit is contained in:
@@ -39,7 +39,7 @@ class ActivityPub::Activity::Follow < ActivityPub::Activity
|
||||
end
|
||||
|
||||
def reject_follow_request!(target_account)
|
||||
json = Oj.dump(serialize_payload(FollowRequest.new(account: @account, target_account: target_account, uri: @json['id']), ActivityPub::RejectFollowSerializer))
|
||||
json = serialize_payload(FollowRequest.new(account: @account, target_account: target_account, uri: @json['id']), ActivityPub::RejectFollowSerializer).to_json
|
||||
ActivityPub::DeliveryWorker.perform_async(json, target_account.id, @account.inbox_url)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -84,6 +84,23 @@ RSpec.describe ActivityPub::Activity::Follow do
|
||||
end
|
||||
end
|
||||
|
||||
context 'when recipient blocks sender' do
|
||||
before { Fabricate :block, account: recipient, target_account: sender }
|
||||
|
||||
it 'sends a reject and does not follow' do
|
||||
subject.perform
|
||||
|
||||
expect(sender.requested?(recipient))
|
||||
.to be false
|
||||
expect(ActivityPub::DeliveryWorker)
|
||||
.to have_enqueued_sidekiq_job(
|
||||
match_json_values(type: 'Reject', object: include(type: 'Follow')),
|
||||
recipient.id,
|
||||
anything
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when a follow relationship already exists' do
|
||||
before do
|
||||
sender.active_relationships.create!(target_account: recipient, uri: 'bar')
|
||||
|
||||
Reference in New Issue
Block a user