Use to_json call for pins API (#38231)

This commit is contained in:
Matt Jankowski
2026-03-16 11:06:22 -04:00
committed by GitHub
parent 968ce25c39
commit 092acbd47b
2 changed files with 6 additions and 2 deletions

View File

@@ -30,7 +30,7 @@ class Api::V1::Statuses::PinsController < Api::V1::Statuses::BaseController
adapter: ActivityPub::Adapter
).as_json
ActivityPub::RawDistributionWorker.perform_async(Oj.dump(json), current_account.id)
ActivityPub::RawDistributionWorker.perform_async(json.to_json, current_account.id)
end
def distribute_remove_activity!
@@ -40,6 +40,6 @@ class Api::V1::Statuses::PinsController < Api::V1::Statuses::BaseController
adapter: ActivityPub::Adapter
).as_json
ActivityPub::RawDistributionWorker.perform_async(Oj.dump(json), current_account.id)
ActivityPub::RawDistributionWorker.perform_async(json.to_json, current_account.id)
end
end

View File

@@ -29,6 +29,8 @@ RSpec.describe 'Pins' do
expect(response.parsed_body).to match(
a_hash_including(id: status.id.to_s, pinned: true)
)
expect(ActivityPub::RawDistributionWorker)
.to have_enqueued_sidekiq_job(match_json_values(type: 'Add'), user.account.id)
end
end
@@ -118,6 +120,8 @@ RSpec.describe 'Pins' do
expect(response.parsed_body).to match(
a_hash_including(id: status.id.to_s, pinned: false)
)
expect(ActivityPub::RawDistributionWorker)
.to have_enqueued_sidekiq_job(match_json_values(type: 'Remove'), user.account.id)
end
end