Daniel Supernault 7 лет назад
Родитель
Сommit
e334eaa809
2 измененных файлов с 7 добавлено и 2 удалено
  1. 2 2
      app/Http/Controllers/LikeController.php
  2. 5 0
      app/Jobs/LikePipeline/LikePipeline.php

+ 2 - 2
app/Http/Controllers/LikeController.php

@@ -27,7 +27,7 @@ class LikeController extends Controller
 
 
       if($status->likes()->whereProfileId($profile->id)->count() !== 0) {
       if($status->likes()->whereProfileId($profile->id)->count() !== 0) {
         $like = Like::whereProfileId($profile->id)->whereStatusId($status->id)->firstOrFail();
         $like = Like::whereProfileId($profile->id)->whereStatusId($status->id)->firstOrFail();
-        $like->delete();
+        $like->forceDelete();
         $count--;
         $count--;
       } else {
       } else {
         $like = new Like;
         $like = new Like;
@@ -35,9 +35,9 @@ class LikeController extends Controller
         $like->status_id = $status->id;
         $like->status_id = $status->id;
         $like->save();
         $like->save();
         $count++;
         $count++;
+        LikePipeline::dispatch($like);
       }
       }
 
 
-      LikePipeline::dispatch($like);
 
 
       if($request->ajax()) {
       if($request->ajax()) {
         $response = ['code' => 200, 'msg' => 'Like saved', 'count' => $count];
         $response = ['code' => 200, 'msg' => 'Like saved', 'count' => $count];

+ 5 - 0
app/Jobs/LikePipeline/LikePipeline.php

@@ -37,6 +37,11 @@ class LikePipeline implements ShouldQueue
         $status = $this->like->status;
         $status = $this->like->status;
         $actor = $this->like->actor;
         $actor = $this->like->actor;
 
 
+        if($status->url !== null) {
+            // Ignore notifications to remote statuses
+            return;
+        }
+
         $exists = Notification::whereProfileId($status->profile_id)
         $exists = Notification::whereProfileId($status->profile_id)
                   ->whereActorId($actor->id)
                   ->whereActorId($actor->id)
                   ->whereAction('like')
                   ->whereAction('like')