Merge pull request #3342 from pixelfed/staging

Staging
This commit is contained in:
daniel 2022-03-30 22:36:37 -06:00 committed by GitHub
commit 8166c1da04
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 2 deletions

View file

@ -113,6 +113,7 @@
- Updated controller signatures, fix mysql 8 support. ([72e3d891](https://github.com/pixelfed/pixelfed/commit/72e3d891))
- Updated ApiV1Controller, remove no-preview image from media urls. ([37dfb101](https://github.com/pixelfed/pixelfed/commit/37dfb101))
- Updated DeleteAccountPipeline, fix perf issues. ([a9edd93f](https://github.com/pixelfed/pixelfed/commit/a9edd93f))
- Updated DeleteAccountPipeline, improve coverage. ([4870cc3b](https://github.com/pixelfed/pixelfed/commit/4870cc3b))
- ([](https://github.com/pixelfed/pixelfed/commit/))
## [v0.11.2 (2022-01-09)](https://github.com/pixelfed/pixelfed/compare/v0.11.1...v0.11.2)

View file

@ -10,10 +10,11 @@ use Illuminate\Foundation\Bus\Dispatchable;
use DB;
use Storage;
use Illuminate\Support\Str;
use App\Services\AccountService;
use App\Services\PublicTimelineService;
use App\{
AccountInterstitial,
AccountLog,
Activity,
Avatar,
Bookmark,
Collection,
@ -39,6 +40,7 @@ use App\{
ReportComment,
ReportLog,
StatusHashtag,
StatusArchived,
Status,
Story,
StoryView,
@ -47,6 +49,7 @@ use App\{
UserFilter,
UserSetting,
};
use App\Models\UserPronoun;
class DeleteAccountPipeline implements ShouldQueue
{
@ -63,6 +66,7 @@ class DeleteAccountPipeline implements ShouldQueue
{
$user = $this->user;
$this->deleteUserColumns($user);
AccountService::del($user->profile_id);
DB::transaction(function() use ($user) {
AccountLog::whereItemType('App\User')->whereItemId($user->id)->forceDelete();
@ -75,6 +79,19 @@ class DeleteAccountPipeline implements ShouldQueue
DB::transaction(function() use ($user) {
if($user->profile) {
$avatar = $user->profile->avatar;
$path = $avatar->media_path;
if(!in_array($path, [
'public/avatars/default.jpg',
'public/avatars/default.png'
])) {
if(config('pixelfed.cloud_storage')) {
$disk = Storage::disk(config('filesystems.cloud'));
$disk->delete($path);
}
$disk = Storage::disk(config('filesystems.local'));
$disk->delete($path);
}
$avatar->forceDelete();
}
@ -102,7 +119,9 @@ class DeleteAccountPipeline implements ShouldQueue
Bookmark::whereProfileId($id)->forceDelete();
EmailVerification::whereUserId($user->id)->forceDelete();
StatusHashtag::whereProfileId($id)->delete();
DirectMessage::whereFromId($id)->delete();
DirectMessage::whereFromId($id)->orWhereToId($id)->delete();
StatusArchived::whereProfileId($id)->delete();
UserPronoun::whereProfileId($id)->delete();
FollowRequest::whereFollowingId($id)
->orWhere('follower_id', $id)
->forceDelete();
@ -157,12 +176,15 @@ class DeleteAccountPipeline implements ShouldQueue
Contact::whereUserId($user->id)->delete();
HashtagFollow::whereUserId($user->id)->delete();
OauthClient::whereUserId($user->id)->delete();
DB::table('oauth_access_tokens')->whereUserId($user->id)->delete();
DB::table('oauth_auth_codes')->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();
PublicTimelineService::warmCache(true, 400);
$this->deleteProfile($user);
});
}