1
0
Fork 0
forked from mirror/pixelfed

Update DeleteAccountPipeline, dispatch on low queue

This commit is contained in:
Daniel Supernault 2022-12-05 01:09:45 -07:00
parent da00287a8e
commit 6eabe07ca3
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
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;