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:
parent
8683a082dd
commit
18fb01ef7c
4 changed files with 18 additions and 19 deletions
|
@ -3,10 +3,13 @@
|
|||
class SuspendAccountService < BaseService
|
||||
include Payloadable
|
||||
|
||||
# Carry out the suspension of a recently-suspended account
|
||||
# @param [Account] account Account to suspend
|
||||
def call(account)
|
||||
return unless account.suspended?
|
||||
|
||||
@account = account
|
||||
|
||||
suspend!
|
||||
reject_remote_follows!
|
||||
distribute_update_actor!
|
||||
unmerge_from_home_timelines!
|
||||
|
@ -16,10 +19,6 @@ class SuspendAccountService < BaseService
|
|||
|
||||
private
|
||||
|
||||
def suspend!
|
||||
@account.suspend! unless @account.suspended?
|
||||
end
|
||||
|
||||
def reject_remote_follows!
|
||||
return if @account.local? || !@account.activitypub?
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue