소스 검색

Update Inbox, only log new activities

Daniel Supernault 5 년 전
부모
커밋
8f2457bbc8
1개의 변경된 파일9개의 추가작업 그리고 3개의 파일을 삭제
  1. 9 3
      app/Util/ActivityPub/Inbox.php

+ 9 - 3
app/Util/ActivityPub/Inbox.php

@@ -41,9 +41,15 @@ class Inbox
     {
         $this->handleVerb();
 
-        (new Activity())->create([
-            'data' => json_encode($this->payload)
-        ]);
+        if(!Activity::where('data->id', $this->payload['id'])->exists()){
+            (new Activity())->create([
+                'to_id' => $this->profile->id,
+                'data' => json_encode($this->payload)
+            ]);
+        }
+
+        return;
+
     }
 
     public function handleVerb()