0
0
Fork 0

Fix possible race conditions when suspending/unsuspending accounts (#22363)

* Fix possible race conditions when suspending/unsuspending accounts

* Fix tests

Tests were assuming SuspensionWorker and UnsuspensionWorker would do the
suspending/unsuspending themselves, but this has changed.
This commit is contained in:
Claire 2023-01-05 13:47:21 +01:00 committed by GitHub
parent 8683a082dd
commit 18fb01ef7c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 19 deletions

View file

@ -13,6 +13,8 @@ RSpec.describe SuspendAccountService, type: :service do
local_follower.follow!(account)
list.accounts << account
account.suspend!
end
it "unmerges from local followers' feeds" do
@ -21,8 +23,8 @@ RSpec.describe SuspendAccountService, type: :service do
expect(FeedManager.instance).to have_received(:unmerge_from_list).with(account, list)
end
it 'marks account as suspended' do
expect { subject }.to change { account.suspended? }.from(false).to(true)
it 'does not change the “suspended” flag' do
expect { subject }.to_not change { account.suspended? }
end
end