This commit is contained in:
KMY 2025-04-03 07:17:26 +09:00
parent 28a08ce478
commit f24f83d9b0
2 changed files with 5 additions and 5 deletions

View file

@ -8,7 +8,7 @@ class Settings::PrivacyExtraController < Settings::BaseController
def update
if UpdateAccountService.new.call(@account, account_params.except(:settings))
current_user.update!(settings_attributes: account_params[:settings])
ActivityPub::UpdateDistributionWorker.perform_async(@account.id)
ActivityPub::UpdateDistributionWorker.perform_in(ActivityPub::UpdateDistributionWorker::DEBOUNCE_DELAY, @account.id)
redirect_to settings_privacy_extra_path, notice: I18n.t('generic.changes_saved_msg')
else
render :show

View file

@ -31,7 +31,7 @@ RSpec.describe Settings::PrivacyController do
describe 'PUT #update' do
context 'when update succeeds' do
before do
allow(ActivityPub::UpdateDistributionWorker).to receive(:perform_async)
allow(ActivityPub::UpdateDistributionWorker).to receive(:perform_in)
end
it 'updates the user profile' do
@ -44,14 +44,14 @@ RSpec.describe Settings::PrivacyController do
.to redirect_to(settings_privacy_path)
expect(ActivityPub::UpdateDistributionWorker)
.to have_received(:perform_async).with(account.id)
.to have_received(:perform_in).with(ActivityPub::UpdateDistributionWorker::DEBOUNCE_DELAY, account.id)
end
end
context 'when update fails' do
before do
allow(UpdateAccountService).to receive(:new).and_return(failing_update_service)
allow(ActivityPub::UpdateDistributionWorker).to receive(:perform_async)
allow(ActivityPub::UpdateDistributionWorker).to receive(:perform_in)
end
it 'updates the user profile' do
@ -61,7 +61,7 @@ RSpec.describe Settings::PrivacyController do
.to render_template(:show)
expect(ActivityPub::UpdateDistributionWorker)
.to_not have_received(:perform_async)
.to_not have_received(:perform_in)
end
private