diff options
author | Chocobozzz <me@florianbigard.com> | 2022-07-15 11:18:29 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-07-15 11:18:29 +0200 |
commit | 654d4ede7fa4d0faa71e49bcfab6b65a686397b2 (patch) | |
tree | af3eb4c4338c5c12cda9a35f03be81d7a82066e1 | |
parent | 319f9670bfd07f19862de565c7cc936ba7f6fda9 (diff) | |
download | PeerTube-654d4ede7fa4d0faa71e49bcfab6b65a686397b2.tar.gz PeerTube-654d4ede7fa4d0faa71e49bcfab6b65a686397b2.tar.zst PeerTube-654d4ede7fa4d0faa71e49bcfab6b65a686397b2.zip |
Correctly handle actors without follow counters
-rw-r--r-- | server/lib/activitypub/actors/shared/url-to-object.ts | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/server/lib/activitypub/actors/shared/url-to-object.ts b/server/lib/activitypub/actors/shared/url-to-object.ts index 12a121725..208d108ee 100644 --- a/server/lib/activitypub/actors/shared/url-to-object.ts +++ b/server/lib/activitypub/actors/shared/url-to-object.ts | |||
@@ -27,8 +27,11 @@ async function fetchRemoteActor (actorUrl: string): Promise<{ statusCode: number | |||
27 | } | 27 | } |
28 | 28 | ||
29 | async function fetchActorFollowsCount (actorObject: ActivityPubActor) { | 29 | async function fetchActorFollowsCount (actorObject: ActivityPubActor) { |
30 | const followersCount = await fetchActorTotalItems(actorObject.followers) | 30 | let followersCount = 0 |
31 | const followingCount = await fetchActorTotalItems(actorObject.following) | 31 | let followingCount = 0 |
32 | |||
33 | if (actorObject.followers) followersCount = await fetchActorTotalItems(actorObject.followers) | ||
34 | if (actorObject.following) followingCount = await fetchActorTotalItems(actorObject.following) | ||
32 | 35 | ||
33 | return { followersCount, followingCount } | 36 | return { followersCount, followingCount } |
34 | } | 37 | } |