From b5cc7b12bc19f2b15387091fc7c3d0348492aef8 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 20 Dec 2018 22:03:01 -0700 Subject: [PATCH] Update DeleteAccountJob --- .../DeletePipeline/DeleteAccountPipeline.php | 49 +++++++++++++------ 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/app/Jobs/DeletePipeline/DeleteAccountPipeline.php b/app/Jobs/DeletePipeline/DeleteAccountPipeline.php index fa2913142..553eaa118 100644 --- a/app/Jobs/DeletePipeline/DeleteAccountPipeline.php +++ b/app/Jobs/DeletePipeline/DeleteAccountPipeline.php @@ -68,8 +68,12 @@ class DeleteAccountPipeline implements ShouldQueue $this->deleteMedia($user); $this->deleteMentions($user); $this->deleteNotifications($user); + $this->deleteStatuses($user); + $this->deleteReports($user); + $this->deleteProfile($user); + $this->deleteUser($user); - // todo send Delete to every known instance sharedInbox + // TODO: send Delete to every known instance sharedInbox } public function deleteAccountLogs($user) @@ -77,7 +81,7 @@ class DeleteAccountPipeline implements ShouldQueue AccountLog::chunk(200, function($logs) use ($user) { foreach($logs as $log) { if($log->user_id == $user->id) { - $log->delete(); + $log->forceDelete(); } } }); @@ -85,7 +89,7 @@ class DeleteAccountPipeline implements ShouldQueue public function deleteActivities($user) { - // todo after AP + // deprecated, removed inbox activity logger } public function deleteAvatar($user) @@ -100,35 +104,35 @@ class DeleteAccountPipeline implements ShouldQueue unlink($avatar->thumb_path); } - $avatar->delete(); + $avatar->forceDelete(); } public function deleteBookmarks($user) { - Bookmark::whereProfileId($user->profile->id)->delete(); + Bookmark::whereProfileId($user->profile->id)->forceDelete(); } public function deleteEmailVerification($user) { - EmailVerification::whereUserId($user->id)->delete(); + EmailVerification::whereUserId($user->id)->forceDelete(); } public function deleteFollowRequests($user) { $id = $user->profile->id; - FollowRequest::whereFollowingId($id)->orWhere('follower_id', $id)->delete(); + FollowRequest::whereFollowingId($id)->orWhere('follower_id', $id)->forceDelete(); } public function deleteFollowers($user) { $id = $user->profile->id; - Follower::whereProfileId($id)->orWhere('following_id', $id)->delete(); + Follower::whereProfileId($id)->orWhere('following_id', $id)->forceDelete(); } public function deleteLikes($user) { $id = $user->profile->id; - Like::whereProfileId($id)->delete(); + Like::whereProfileId($id)->forceDelete(); } public function deleteMedia($user) @@ -143,23 +147,36 @@ class DeleteAccountPipeline implements ShouldQueue if(is_file($thumb)) { unlink($thumb); } - $media->delete(); + $media->forceDelete(); } } public function deleteMentions($user) { - Mention::whereProfileId($user->profile->id)->delete(); + Mention::whereProfileId($user->profile->id)->forceDelete(); } public function deleteNotifications($user) { $id = $user->profile->id; - Notification::whereProfileId($id)->orWhere('actor_id', $id)->delete(); + Notification::whereProfileId($id)->orWhere('actor_id', $id)->forceDelete(); } - public function deleteProfile($user) {} - public function deleteReports($user) {} - public function deleteStatuses($user) {} - public function deleteUser($user) {} + public function deleteStatuses($user) { + Status::whereProfileId($user->profile->id)->forceDelete(); + } + + public function deleteProfile($user) { + Profile::whereUserId($user->id)->delete(); + } + + public function deleteReports($user) { + Report::whereUserId($user->id)->forceDelete(); + } + + public function deleteUser($user) { + UserFilter::find($user->id)->forceDelete(); + UserSetting::find($user->id)->forceDelete(); + User::find($user->id)->forceDelete(); + } }