From 7006bc6378eb0d480bc5b60f2c18876f0bb2a97d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 15 Jan 2018 09:46:46 +0100 Subject: Fix actor followers/following counts --- server/lib/activitypub/actor.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'server/lib/activitypub') diff --git a/server/lib/activitypub/actor.ts b/server/lib/activitypub/actor.ts index b3fb75421..2e0f3cfc2 100644 --- a/server/lib/activitypub/actor.ts +++ b/server/lib/activitypub/actor.ts @@ -132,15 +132,13 @@ async function fetchActorTotalItems (url: string) { activityPub: true } - let requestResult try { - requestResult = await doRequest(options) + const { body } = await doRequest(options) + return body.totalItems ? body.totalItems : 0 } catch (err) { logger.warn('Cannot fetch remote actor count %s.', url, err) - return undefined + return 0 } - - return requestResult.totalItems ? requestResult.totalItems : 0 } async function fetchAvatarIfExists (actorJSON: ActivityPubActor) { @@ -314,7 +312,6 @@ async function refreshActorIfNeeded (actor: ActorModel) { if (result === undefined) throw new Error('Cannot fetch remote actor in refresh actor.') return sequelizeTypescript.transaction(async t => { - logger.info('coucou', result.actor.toJSON()) updateInstanceWithAnother(actor, result.actor) if (result.avatarName !== undefined) { -- cgit v1.2.3