From e334eaa809f24ae0d651324d98935d6d2dd2a292 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 12 Jul 2018 16:48:19 -0600 Subject: [PATCH] Update LikeController --- app/Http/Controllers/LikeController.php | 4 ++-- app/Jobs/LikePipeline/LikePipeline.php | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/LikeController.php b/app/Http/Controllers/LikeController.php index 0ca585ccc..4cc5982db 100644 --- a/app/Http/Controllers/LikeController.php +++ b/app/Http/Controllers/LikeController.php @@ -27,7 +27,7 @@ class LikeController extends Controller if($status->likes()->whereProfileId($profile->id)->count() !== 0) { $like = Like::whereProfileId($profile->id)->whereStatusId($status->id)->firstOrFail(); - $like->delete(); + $like->forceDelete(); $count--; } else { $like = new Like; @@ -35,9 +35,9 @@ class LikeController extends Controller $like->status_id = $status->id; $like->save(); $count++; + LikePipeline::dispatch($like); } - LikePipeline::dispatch($like); if($request->ajax()) { $response = ['code' => 200, 'msg' => 'Like saved', 'count' => $count]; diff --git a/app/Jobs/LikePipeline/LikePipeline.php b/app/Jobs/LikePipeline/LikePipeline.php index 9d53fd8b1..8eccd726f 100644 --- a/app/Jobs/LikePipeline/LikePipeline.php +++ b/app/Jobs/LikePipeline/LikePipeline.php @@ -37,6 +37,11 @@ class LikePipeline implements ShouldQueue $status = $this->like->status; $actor = $this->like->actor; + if($status->url !== null) { + // Ignore notifications to remote statuses + return; + } + $exists = Notification::whereProfileId($status->profile_id) ->whereActorId($actor->id) ->whereAction('like')