]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/activitypub/follow.ts
Refactor playlist creation for lives
[github/Chocobozzz/PeerTube.git] / server / lib / activitypub / follow.ts
index c1bd667e04e1def55d048eeca0b5cf4b5aa16a5f..f6e2a48fdec3e889bb04a9c72d832fbb110eef35 100644 (file)
@@ -27,10 +27,25 @@ async function autoFollowBackIfNeeded (actorFollow: MActorFollowActors, transact
       isAutoFollow: true
     }
 
-    JobQueue.Instance.createJob({ type: 'activitypub-follow', payload })
+    JobQueue.Instance.createJobAsync({ type: 'activitypub-follow', payload })
   }
 }
 
+// If we only have an host, use a default account handle
+function getRemoteNameAndHost (handleOrHost: string) {
+  let name = SERVER_ACTOR_NAME
+  let host = handleOrHost
+
+  const splitted = handleOrHost.split('@')
+  if (splitted.length === 2) {
+    name = splitted[0]
+    host = splitted[1]
+  }
+
+  return { name, host }
+}
+
 export {
-  autoFollowBackIfNeeded
+  autoFollowBackIfNeeded,
+  getRemoteNameAndHost
 }