From dab051ecb952d0801d798738fe5d500c457d582c Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 13 Dec 2020 11:40:28 -0700 Subject: [PATCH 1/2] Update console kernel --- .../Commands/FixSoftDeletedProfile.php | 60 +++++++++++++++++++ app/Console/Kernel.php | 1 + 2 files changed, 61 insertions(+) create mode 100644 app/Console/Commands/FixSoftDeletedProfile.php diff --git a/app/Console/Commands/FixSoftDeletedProfile.php b/app/Console/Commands/FixSoftDeletedProfile.php new file mode 100644 index 000000000..3fe90ff3c --- /dev/null +++ b/app/Console/Commands/FixSoftDeletedProfile.php @@ -0,0 +1,60 @@ +withTrashed() + ->where('deleted_at', '>', now()->subDays(14)) + ->whereNull('status') + ->pluck('username'); + + if($profiles->count() == 0) { + return 0; + } + + foreach($profiles as $p) { + if(User::whereUsername($p)->first()->status == null) { + $pro = Profile::withTrashed()->whereUsername($p)->firstOrFail(); + $pro->deleted_at = null; + $pro->save(); + } + } + } +} diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index a29ace355..d5e1d47a4 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -31,6 +31,7 @@ class Kernel extends ConsoleKernel ->hourly(); $schedule->command('horizon:snapshot')->everyFiveMinutes(); $schedule->command('story:gc')->everyFiveMinutes(); + $schedule->command('fix:sdprofile')->everyFiveMinutes(); $schedule->command('gc:failedjobs')->dailyAt(3); $schedule->command('gc:passwordreset')->dailyAt('09:41'); } From b69aa4af3c5450aeff004b8d62c79e054702c2b0 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 13 Dec 2020 11:41:10 -0700 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 247c74abd..dd281e3b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -130,6 +130,7 @@ - Updated AccountInterstitialController, add autospam type. ([c67f0c57](https://github.com/pixelfed/pixelfed/commit/c67f0c57)) - Updated Profile model, improve counter caching. ([4a14e970](https://github.com/pixelfed/pixelfed/commit/4a14e970)) - Updated ComposeModal, fix filter bug on safari. ([8e3e7586](https://github.com/pixelfed/pixelfed/commit/8e3e7586)) +- Updated StatusStatelessController, remove unused attributes. ([d0d46807](https://github.com/pixelfed/pixelfed/commit/d0d46807)) ## [v0.10.9 (2020-04-17)](https://github.com/pixelfed/pixelfed/compare/v0.10.8...v0.10.9) ### Added