Merge pull request #3341 from pixelfed/staging

Staging
This commit is contained in:
daniel 2022-03-30 21:46:03 -06:00 committed by GitHub
commit d9fc0aff16
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 27 deletions

View file

@ -111,6 +111,8 @@
- Updated ApiV1Controller, update statusCreate entity. ([a84ab6ea](https://github.com/pixelfed/pixelfed/commit/a84ab6ea))
- Updated ApiV1Controller, remove pinned attribute to match MastoAPI Status entity. ([6057de30](https://github.com/pixelfed/pixelfed/commit/6057de30))
- 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))
- ([](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

@ -1448,8 +1448,6 @@ class ApiV1Controller extends Controller
$resource = new Fractal\Resource\Item($media, new MediaTransformer());
$res = $this->fractal->createData($resource)->toArray();
$res['preview_url'] = url('/storage/no-preview.png');
$res['url'] = url('/storage/no-preview.png');
return $this->json($res);
}
@ -1472,8 +1470,6 @@ class ApiV1Controller extends Controller
$resource = new Fractal\Resource\Item($media, new MediaTransformer());
$res = $this->fractal->createData($resource)->toArray();
$res['preview_url'] = url('/storage/no-preview.png');
$res['url'] = url('/storage/no-preview.png');
return $this->json($res);
}

View file

@ -8,6 +8,7 @@ use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use DB;
use Storage;
use Illuminate\Support\Str;
use App\{
AccountInterstitial,
@ -61,15 +62,10 @@ class DeleteAccountPipeline implements ShouldQueue
public function handle()
{
$user = $this->user;
$this->deleteUserColumns($user);
DB::transaction(function() use ($user) {
AccountLog::chunk(200, function($logs) use ($user) {
foreach($logs as $log) {
if($log->user_id == $user->id) {
$log->forceDelete();
}
}
});
AccountLog::whereItemType('App\User')->whereItemId($user->id)->forceDelete();
});
DB::transaction(function() use ($user) {
@ -133,14 +129,14 @@ class DeleteAccountPipeline implements ShouldQueue
DB::transaction(function() use ($user) {
$medias = Media::whereUserId($user->id)->get();
foreach($medias as $media) {
$path = storage_path('app/'.$media->media_path);
$thumb = storage_path('app/'.$media->thumbnail_path);
if(is_file($path)) {
unlink($path);
}
if(is_file($thumb)) {
unlink($thumb);
if(config('pixelfed.cloud_storage')) {
$disk = Storage::disk(config('filesystems.cloud'));
$disk->delete($media->media_path);
$disk->delete($media->thumbnail_path);
}
$disk = Storage::disk(config('filesystems.local'));
$disk->delete($media->media_path);
$disk->delete($media->thumbnail_path);
$media->forceDelete();
}
});
@ -165,14 +161,7 @@ class DeleteAccountPipeline implements ShouldQueue
});
DB::transaction(function() use ($user) {
Status::whereProfileId($user->profile_id)
->cursor()
->each(function($status) {
AccountInterstitial::where('item_type', 'App\Status')
->where('item_id', $status->id)
->delete();
$status->forceDelete();
});
Status::whereProfileId($user->profile_id)->forceDelete();
Report::whereUserId($user->id)->forceDelete();
$this->deleteProfile($user);
});
@ -191,7 +180,6 @@ class DeleteAccountPipeline implements ShouldQueue
UserDevice::whereUserId($user->id)->forceDelete();
UserFilter::whereUserId($user->id)->forceDelete();
UserSetting::whereUserId($user->id)->forceDelete();
$this->deleteUserColumns($user);
});
}