mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 00:03:16 +00:00
Update delete handler
This commit is contained in:
parent
446f291036
commit
63eceb8236
2 changed files with 38 additions and 4 deletions
|
@ -24,8 +24,11 @@ use App\{
|
|||
FollowRequest,
|
||||
Hashtag,
|
||||
HashtagFollow,
|
||||
ImportData,
|
||||
ImportJob,
|
||||
Like,
|
||||
Media,
|
||||
MediaTag,
|
||||
Mention,
|
||||
Notification,
|
||||
OauthClient,
|
||||
|
@ -81,10 +84,29 @@ class DeleteAccountPipeline implements ShouldQueue
|
|||
|
||||
$id = $user->profile_id;
|
||||
|
||||
Bookmark::whereProfileId($user->profile_id)->forceDelete();
|
||||
ImportData::whereProfileId($id)
|
||||
->cursor()
|
||||
->each(function($data) {
|
||||
$path = storage_path('app/'.$data->path);
|
||||
if(is_file($path)) {
|
||||
unlink($path);
|
||||
}
|
||||
$data->delete();
|
||||
});
|
||||
ImportJob::whereProfileId($id)
|
||||
->cursor()
|
||||
->each(function($data) {
|
||||
$path = storage_path('app/'.$data->media_json);
|
||||
if(is_file($path)) {
|
||||
unlink($path);
|
||||
}
|
||||
$data->delete();
|
||||
});
|
||||
MediaTag::whereProfileId($id)->delete();
|
||||
Bookmark::whereProfileId($id)->forceDelete();
|
||||
EmailVerification::whereUserId($user->id)->forceDelete();
|
||||
StatusHashtag::whereProfileId($id)->delete();
|
||||
DirectMessage::whereFromId($user->profile_id)->delete();
|
||||
DirectMessage::whereFromId($id)->delete();
|
||||
FollowRequest::whereFollowingId($id)
|
||||
->orWhere('follower_id', $id)
|
||||
->forceDelete();
|
||||
|
@ -143,7 +165,14 @@ class DeleteAccountPipeline implements ShouldQueue
|
|||
});
|
||||
|
||||
DB::transaction(function() use ($user) {
|
||||
Status::whereProfileId($user->profile_id)->forceDelete();
|
||||
Status::whereProfileId($user->profile_id)
|
||||
->cursor()
|
||||
->each(function($status) {
|
||||
AccountInterstitial::where('item_type', 'App\Status')
|
||||
->where('item_id', $status->id)
|
||||
->delete();
|
||||
$status->forceDelete();
|
||||
});
|
||||
Report::whereUserId($user->id)->forceDelete();
|
||||
$this->deleteProfile($user);
|
||||
});
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace App\Jobs\StatusPipeline;
|
|||
|
||||
use DB;
|
||||
use App\{
|
||||
AccountInterstitial,
|
||||
MediaTag,
|
||||
Notification,
|
||||
Report,
|
||||
|
@ -113,7 +114,11 @@ class StatusDelete implements ShouldQueue
|
|||
->where('item_id', $tag->id)
|
||||
->forceDelete();
|
||||
$tag->delete();
|
||||
});
|
||||
});
|
||||
|
||||
AccountInterstitial::where('item_type', 'App\Status')
|
||||
->where('item_id', $status->id)
|
||||
->delete();
|
||||
|
||||
$status->forceDelete();
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue