1
0
Fork 0

Correctly handle actors without follow counters

This commit is contained in:
Chocobozzz 2022-07-15 11:18:29 +02:00
parent 319f9670bf
commit 654d4ede7f
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 5 additions and 2 deletions

View File

@ -27,8 +27,11 @@ async function fetchRemoteActor (actorUrl: string): Promise<{ statusCode: number
}
async function fetchActorFollowsCount (actorObject: ActivityPubActor) {
const followersCount = await fetchActorTotalItems(actorObject.followers)
const followingCount = await fetchActorTotalItems(actorObject.following)
let followersCount = 0
let followingCount = 0
if (actorObject.followers) followersCount = await fetchActorTotalItems(actorObject.followers)
if (actorObject.following) followingCount = await fetchActorTotalItems(actorObject.following)
return { followersCount, followingCount }
}