Merge pull request #3901 from pixelfed/staging

Update DeleteAccountPipeline, dispatch on low queue
This commit is contained in:
daniel 2022-12-05 01:14:46 -07:00 committed by GitHub
commit cfc1067763
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -23,6 +23,7 @@ use App\Http\Controllers\Settings\{
}; };
use App\Jobs\DeletePipeline\DeleteAccountPipeline; use App\Jobs\DeletePipeline\DeleteAccountPipeline;
use App\Jobs\MediaPipeline\MediaSyncLicensePipeline; use App\Jobs\MediaPipeline\MediaSyncLicensePipeline;
use App\Services\AccountService;
class SettingsController extends Controller class SettingsController extends Controller
{ {
@ -136,6 +137,8 @@ class SettingsController extends Controller
abort_if($user->is_admin, 403); abort_if($user->is_admin, 403);
$profile = $user->profile; $profile = $user->profile;
$ts = Carbon::now()->addMonth(); $ts = Carbon::now()->addMonth();
$user->email = $user->id;
$user->password = '';
$user->status = 'delete'; $user->status = 'delete';
$profile->status = 'delete'; $profile->status = 'delete';
$user->delete_after = $ts; $user->delete_after = $ts;
@ -143,8 +146,9 @@ class SettingsController extends Controller
$user->save(); $user->save();
$profile->save(); $profile->save();
Cache::forget('profiles:private'); Cache::forget('profiles:private');
AccountService::del($profile->id);
Auth::logout(); Auth::logout();
DeleteAccountPipeline::dispatch($user)->onQueue('high'); DeleteAccountPipeline::dispatch($user)->onQueue('low');
return redirect('/'); return redirect('/');
} }

View file

@ -57,6 +57,8 @@ class DeleteAccountPipeline implements ShouldQueue
protected $user; protected $user;
public $timeout = 900;
public function __construct(User $user) public function __construct(User $user)
{ {
$this->user = $user; $this->user = $user;