Procházet zdrojové kódy

Update MovePipeline CleanupLegacyAccountMovePipeline, set moved_to_profile_id attribute on old account and clear AccountService caches accordingly

Daniel Supernault před 10 měsíci
rodič
revize
0d8c142bf3

+ 11 - 0
app/Jobs/MovePipeline/CleanupLegacyAccountMovePipeline.php

@@ -3,6 +3,8 @@
 namespace App\Jobs\MovePipeline;
 
 use App\Follower;
+use App\Profile;
+use App\Services\AccountService;
 use App\Util\ActivityPub\Helpers;
 use DateTime;
 use Exception;
@@ -83,5 +85,14 @@ class CleanupLegacyAccountMovePipeline implements ShouldQueue
         }
 
         Follower::whereFollowingId($actorAccount['id'])->delete();
+
+        $oldProfile = Profile::find($actorAccount['id']);
+
+        if ($oldProfile) {
+            $oldProfile->moved_to_profile_id = $targetAccount['id'];
+            $oldProfile->save();
+            AccountService::del($oldProfile->id);
+            AccountService::del($targetAccount['id']);
+        }
     }
 }