From 86efcceb4c985c361c4b5f0d2b2e8e6f13acdb98 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 7 Jun 2018 00:14:32 -0600 Subject: [PATCH] Update LikePipeline, prevent duplicate like notifications --- app/Jobs/LikePipeline/LikePipeline.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/Jobs/LikePipeline/LikePipeline.php b/app/Jobs/LikePipeline/LikePipeline.php index 28410bfc3..9d53fd8b1 100644 --- a/app/Jobs/LikePipeline/LikePipeline.php +++ b/app/Jobs/LikePipeline/LikePipeline.php @@ -37,7 +37,14 @@ class LikePipeline implements ShouldQueue $status = $this->like->status; $actor = $this->like->actor; - if($actor->id === $status->profile_id) { + $exists = Notification::whereProfileId($status->profile_id) + ->whereActorId($actor->id) + ->whereAction('like') + ->whereItemId($status->id) + ->whereItemType('App\Status') + ->count(); + + if($actor->id === $status->profile_id || $exists !== 0) { return true; }