From 95d281ef9a380bc15b312ee27a5dfffce3dad9fa Mon Sep 17 00:00:00 2001 From: okpierre <1679025+okpierre@users.noreply.github.com> Date: Wed, 21 Oct 2020 17:03:21 -0400 Subject: [PATCH 1/4] Update PostComponent.vue Allow word to wrap instead of breaking up --- resources/assets/js/components/PostComponent.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/assets/js/components/PostComponent.vue b/resources/assets/js/components/PostComponent.vue index 5ca341865..b7942417a 100644 --- a/resources/assets/js/components/PostComponent.vue +++ b/resources/assets/js/components/PostComponent.vue @@ -146,7 +146,7 @@

{{statusUsername}} - +


From 881fa86573db503f798b8cbca8031c2fc9d9bc2b Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 13 Dec 2020 17:28:33 -0700 Subject: [PATCH 2/4] Update NotificationTransformer, handle tagged deletes --- app/Jobs/StatusPipeline/StatusDelete.php | 13 +++++++++++++ app/Notification.php | 6 ++++++ app/Transformer/Api/NotificationTransformer.php | 5 +++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/app/Jobs/StatusPipeline/StatusDelete.php b/app/Jobs/StatusPipeline/StatusDelete.php index ab42c2d8a..c910d6cd6 100644 --- a/app/Jobs/StatusPipeline/StatusDelete.php +++ b/app/Jobs/StatusPipeline/StatusDelete.php @@ -4,6 +4,7 @@ namespace App\Jobs\StatusPipeline; use DB; use App\{ + MediaTag, Notification, Report, Status, @@ -104,6 +105,18 @@ class StatusDelete implements ShouldQueue Report::whereObjectType('App\Status') ->whereObjectId($status->id) ->delete(); + + MediaTag::where('status_id', $status->id) + ->cursor() + ->each(function($tag) { + Notification::where('item_type', 'App\MediaTag') + ->where('item_id', $tag->id) + ->forceDelete(); + $tag->delete(); + }); + + MediaTag::whereStatusId($status->id) + ->get(); $status->forceDelete(); }); diff --git a/app/Notification.php b/app/Notification.php index ae5cd567f..ebd6f6415 100644 --- a/app/Notification.php +++ b/app/Notification.php @@ -37,4 +37,10 @@ class Notification extends Model { return $this->belongsTo(Status::class, 'item_id', 'id'); } + + public function tag() + { + return $this->hasOne(MediaTag::class, 'item_id', 'id'); + } + } diff --git a/app/Transformer/Api/NotificationTransformer.php b/app/Transformer/Api/NotificationTransformer.php index cc75bfd83..981e5f727 100644 --- a/app/Transformer/Api/NotificationTransformer.php +++ b/app/Transformer/Api/NotificationTransformer.php @@ -6,6 +6,7 @@ use App\{ Notification, Status }; +use App\Services\HashidService; use League\Fractal; class NotificationTransformer extends Fractal\TransformerAbstract @@ -97,8 +98,8 @@ class NotificationTransformer extends Fractal\TransformerAbstract $ml = $n->item; $res = $this->item($ml, function($ml) { return [ - 'username' => $ml->status->profile->username, - 'post_url' => $ml->status->url() + 'username' => $ml->tagged_username, + 'post_url' => '/p/'.HashidService::encode($ml->status_id) ]; }); return $res; From 72272d8f0938b7e6699435437996a312ea7e7175 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 13 Dec 2020 17:29:11 -0700 Subject: [PATCH 3/4] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cba00ac39..c5a753772 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -134,6 +134,7 @@ - Updated Profile, fix follower counter bug. ([d06bec9c](https://github.com/pixelfed/pixelfed/commit/d06bec9c)) - Updated NotificationTransformer, add missing types. ([3a428366](https://github.com/pixelfed/pixelfed/commit/3a428366)) - Updated StatusService, fix json bug. ([1ea2db74](https://github.com/pixelfed/pixelfed/commit/1ea2db74)) +- Updated NotificationTransformer, handle tagged deletes. ([881fa865](https://github.com/pixelfed/pixelfed/commit/881fa865)) ## [v0.10.9 (2020-04-17)](https://github.com/pixelfed/pixelfed/compare/v0.10.8...v0.10.9) ### Added From a5019b8907ece32cc45bd38210b38da23e832eda Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 13 Dec 2020 17:30:50 -0700 Subject: [PATCH 4/4] Update StatusController --- app/Http/Controllers/StatusController.php | 5 ++++- app/Jobs/StatusPipeline/StatusDelete.php | 2 -- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/StatusController.php b/app/Http/Controllers/StatusController.php index c0bf8e06d..6f8eac91f 100644 --- a/app/Http/Controllers/StatusController.php +++ b/app/Http/Controllers/StatusController.php @@ -74,7 +74,10 @@ class StatusController extends Controller return redirect('/login?next='.urlencode('/' . $request->path())); } $id = HashidService::decode($id); - $status = Status::findOrFail($id); + $status = Status::find($id); + if(!$status) { + return redirect('/404'); + } return redirect($status->url()); } diff --git a/app/Jobs/StatusPipeline/StatusDelete.php b/app/Jobs/StatusPipeline/StatusDelete.php index c910d6cd6..09ba5ba5b 100644 --- a/app/Jobs/StatusPipeline/StatusDelete.php +++ b/app/Jobs/StatusPipeline/StatusDelete.php @@ -115,8 +115,6 @@ class StatusDelete implements ShouldQueue $tag->delete(); }); - MediaTag::whereStatusId($status->id) - ->get(); $status->forceDelete(); });