]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Refresh orphan actors
authorChocobozzz <me@florianbigard.com>
Tue, 31 Jul 2018 09:04:33 +0000 (11:04 +0200)
committerChocobozzz <me@florianbigard.com>
Tue, 31 Jul 2018 09:04:33 +0000 (11:04 +0200)
server/lib/activitypub/actor.ts

index 9257d7d209843ac75c763ef09dff0caee661eae2..7f2fc32365f7a6a7289888744efae05bbd8ffb00 100644 (file)
@@ -40,6 +40,11 @@ async function getOrCreateActorAndServerAndModel (activityActor: string | Activi
   const actorUrl = getActorUrl(activityActor)
 
   let actor = await ActorModel.loadByUrl(actorUrl)
+  // Orphan actor (not associated to an account of channel) so recreate it
+  if (!actor.Account && !actor.VideoChannel) {
+    await actor.destroy()
+    actor = null
+  }
 
   // We don't have this actor in our database, fetch it on remote
   if (!actor) {