Browse Source

Update AP Inbox

Daniel Supernault 6 năm trước cách đây
mục cha
commit
4219abe95c
1 tập tin đã thay đổi với 16 bổ sung2 xóa
  1. 16 2
      app/Util/ActivityPub/Inbox.php

+ 16 - 2
app/Util/ActivityPub/Inbox.php

@@ -235,7 +235,7 @@ class Inbox
             'item_id' => $parent->id,
             'item_type' => 'App\Status'
         ]);
-        
+
         $parent->reblogs_count = $parent->shares()->count();
         $parent->save();
     }
@@ -323,6 +323,20 @@ class Inbox
                 break;
                 
             case 'Announce':
+                abort_if(!Helpers::validateLocalUrl($obj), 400);
+                $status = Helpers::statusFetch($obj);
+                if(!$status) {
+                    return;
+                }
+                Status::whereProfileId($profile->id)
+                    ->whereReblogOfId($status->id)
+                    ->forceDelete();
+                Notification::whereProfileId($status->profile->id)
+                    ->whereActorId($profile->id)
+                    ->whereAction('share')
+                    ->whereItemId($status->reblog_of_id)
+                    ->whereItemType('App\Status')
+                    ->forceDelete();
                 break;
 
             case 'Block':
@@ -354,6 +368,6 @@ class Inbox
                     ->forceDelete();
                 break;
         }
-
+        return;
     }
 }