0
0
Fork 0

Add delay to profile updates to debounce them (#34137)

This commit is contained in:
Claire 2025-03-11 17:17:17 +01:00 committed by GitHub
parent 725a68d273
commit 420ffdfb62
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 17 additions and 23 deletions

View file

@ -53,8 +53,6 @@ RSpec.describe 'credentials API' do
patch '/api/v1/accounts/update_credentials', headers: headers, params: params
end
before { allow(ActivityPub::UpdateDistributionWorker).to receive(:perform_async) }
let(:params) do
{
avatar: fixture_file_upload('avatar.gif', 'image/gif'),
@ -113,7 +111,7 @@ RSpec.describe 'credentials API' do
})
expect(ActivityPub::UpdateDistributionWorker)
.to have_received(:perform_async).with(user.account_id)
.to have_enqueued_sidekiq_job(user.account_id)
end
def expect_account_updates

View file

@ -15,10 +15,6 @@ RSpec.describe 'Deleting profile images' do
let(:headers) { { 'Authorization' => "Bearer #{token.token}" } }
describe 'DELETE /api/v1/profile' do
before do
allow(ActivityPub::UpdateDistributionWorker).to receive(:perform_async)
end
context 'when deleting an avatar' do
context 'with wrong scope' do
before do
@ -38,7 +34,8 @@ RSpec.describe 'Deleting profile images' do
account.reload
expect(account.avatar).to_not exist
expect(account.header).to exist
expect(ActivityPub::UpdateDistributionWorker).to have_received(:perform_async).with(account.id)
expect(ActivityPub::UpdateDistributionWorker)
.to have_enqueued_sidekiq_job(account.id)
end
end
@ -61,7 +58,8 @@ RSpec.describe 'Deleting profile images' do
account.reload
expect(account.avatar).to exist
expect(account.header).to_not exist
expect(ActivityPub::UpdateDistributionWorker).to have_received(:perform_async).with(account.id)
expect(ActivityPub::UpdateDistributionWorker)
.to have_enqueued_sidekiq_job(account.id)
end
end
end