Browse Source

Update Inbox handler, improve Undo Follow logic

Daniel Supernault 3 tháng trước cách đây
mục cha
commit
5525369fec
1 tập tin đã thay đổi với 11 bổ sung2 xóa
  1. 11 2
      app/Util/ActivityPub/Inbox.php

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

@@ -619,7 +619,10 @@ class Inbox
             Cache::forget('profile:following_count:'.$target->id);
             Cache::forget('profile:following_count:'.$target->id);
             Cache::forget('profile:following_count:'.$actor->id);
             Cache::forget('profile:following_count:'.$actor->id);
         }
         }
-
+        RelationshipService::refresh($actor->id, $target->id);
+        AccountService::del($actor->id);
+        AccountService::del($target->id);
+        return;
     }
     }
 
 
     public function handleAnnounceActivity()
     public function handleAnnounceActivity()
@@ -871,7 +874,7 @@ class Inbox
 
 
         FollowRequest::whereFollowerId($profile->id)->whereFollowingId($actor->id)->forceDelete();
         FollowRequest::whereFollowerId($profile->id)->whereFollowingId($actor->id)->forceDelete();
         RelationshipService::refresh($actor->id, $profile->id);
         RelationshipService::refresh($actor->id, $profile->id);
-
+        return;
     }
     }
 
 
     public function handleUndoActivity()
     public function handleUndoActivity()
@@ -938,6 +941,9 @@ class Inbox
                 Follower::whereProfileId($profile->id)
                 Follower::whereProfileId($profile->id)
                     ->whereFollowingId($following->id)
                     ->whereFollowingId($following->id)
                     ->delete();
                     ->delete();
+                FollowRequest::whereFollowingId($following->id)
+                    ->whereFollowerId($profile->id)
+                    ->forceDelete();
                 Notification::whereProfileId($following->id)
                 Notification::whereProfileId($following->id)
                     ->whereActorId($profile->id)
                     ->whereActorId($profile->id)
                     ->whereAction('follow')
                     ->whereAction('follow')
@@ -945,6 +951,9 @@ class Inbox
                     ->whereItemType('App\Profile')
                     ->whereItemType('App\Profile')
                     ->forceDelete();
                     ->forceDelete();
                 FollowerService::remove($profile->id, $following->id);
                 FollowerService::remove($profile->id, $following->id);
+                RelationshipService::refresh($following->id, $profile->id);
+                AccountService::del($profile->id);
+                AccountService::del($following->id);
                 break;
                 break;
 
 
             case 'Like':
             case 'Like':