|
|
|
@ -15,16 +15,21 @@ use App\{
|
|
|
|
|
Avatar,
|
|
|
|
|
Bookmark,
|
|
|
|
|
Collection,
|
|
|
|
|
CollectionItem,
|
|
|
|
|
Contact,
|
|
|
|
|
DirectMessage,
|
|
|
|
|
EmailVerification,
|
|
|
|
|
Follower,
|
|
|
|
|
FollowRequest,
|
|
|
|
|
Hashtag,
|
|
|
|
|
HashtagFollow,
|
|
|
|
|
Like,
|
|
|
|
|
Media,
|
|
|
|
|
Mention,
|
|
|
|
|
Notification,
|
|
|
|
|
OauthClient,
|
|
|
|
|
Profile,
|
|
|
|
|
ProfileSponsor,
|
|
|
|
|
Report,
|
|
|
|
|
ReportComment,
|
|
|
|
|
ReportLog,
|
|
|
|
@ -44,24 +49,15 @@ class DeleteAccountPipeline implements ShouldQueue
|
|
|
|
|
|
|
|
|
|
protected $user;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create a new job instance.
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
public function __construct(User $user)
|
|
|
|
|
{
|
|
|
|
|
$this->user = $user;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Execute the job.
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
public function handle()
|
|
|
|
|
{
|
|
|
|
|
$user = $this->user;
|
|
|
|
|
|
|
|
|
|
DB::transaction(function() use ($user) {
|
|
|
|
|
AccountLog::chunk(200, function($logs) use ($user) {
|
|
|
|
|
foreach($logs as $log) {
|
|
|
|
@ -75,21 +71,20 @@ class DeleteAccountPipeline implements ShouldQueue
|
|
|
|
|
DB::transaction(function() use ($user) {
|
|
|
|
|
if($user->profile) {
|
|
|
|
|
$avatar = $user->profile->avatar;
|
|
|
|
|
|
|
|
|
|
$avatar->forceDelete();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Bookmark::whereProfileId($user->profile->id)->forceDelete();
|
|
|
|
|
$id = $user->profile_id;
|
|
|
|
|
|
|
|
|
|
Bookmark::whereProfileId($user->profile_id)->forceDelete();
|
|
|
|
|
EmailVerification::whereUserId($user->id)->forceDelete();
|
|
|
|
|
$id = $user->profile->id;
|
|
|
|
|
|
|
|
|
|
StatusHashtag::whereProfileId($id)->delete();
|
|
|
|
|
|
|
|
|
|
FollowRequest::whereFollowingId($id)->orWhere('follower_id', $id)->forceDelete();
|
|
|
|
|
|
|
|
|
|
Follower::whereProfileId($id)->orWhere('following_id', $id)->forceDelete();
|
|
|
|
|
|
|
|
|
|
FollowRequest::whereFollowingId($id)
|
|
|
|
|
->orWhere('follower_id', $id)
|
|
|
|
|
->forceDelete();
|
|
|
|
|
Follower::whereProfileId($id)
|
|
|
|
|
->orWhere('following_id', $id)
|
|
|
|
|
->forceDelete();
|
|
|
|
|
Like::whereProfileId($id)->forceDelete();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -123,12 +118,26 @@ class DeleteAccountPipeline implements ShouldQueue
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
DB::transaction(function() use ($user) {
|
|
|
|
|
Mention::whereProfileId($user->profile->id)->forceDelete();
|
|
|
|
|
Notification::whereProfileId($user->profile->id)->orWhere('actor_id', $user->profile->id)->forceDelete();
|
|
|
|
|
Mention::whereProfileId($user->profile_id)->forceDelete();
|
|
|
|
|
Notification::whereProfileId($user->profile_id)
|
|
|
|
|
->orWhere('actor_id', $user->profile_id)
|
|
|
|
|
->forceDelete();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
DB::transaction(function() use ($user) {
|
|
|
|
|
Status::whereProfileId($user->profile->id)->forceDelete();
|
|
|
|
|
$collections = Collection::whereProfileId($user->profile_id)->get();
|
|
|
|
|
foreach ($collections as $collection) {
|
|
|
|
|
$collection->items()->delete();
|
|
|
|
|
$collection->delete();
|
|
|
|
|
}
|
|
|
|
|
Contact::whereUserId($user->id)->delete();
|
|
|
|
|
HashtagFollow::whereUserId($user->id)->delete();
|
|
|
|
|
OauthClient::whereUserId($user->id)->delete();
|
|
|
|
|
ProfileSponsor::whereProfileId($user->profile_id)->delete();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
DB::transaction(function() use ($user) {
|
|
|
|
|
Status::whereProfileId($user->profile_id)->forceDelete();
|
|
|
|
|
Report::whereUserId($user->id)->forceDelete();
|
|
|
|
|
$this->deleteProfile($user);
|
|
|
|
|
});
|
|
|
|
@ -166,6 +175,5 @@ class DeleteAccountPipeline implements ShouldQueue
|
|
|
|
|
$user->{'2fa_setup_at'} = null;
|
|
|
|
|
$user->save();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|