aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-01-15 09:46:46 +0100
committerChocobozzz <me@florianbigard.com>2018-01-15 09:47:19 +0100
commit7006bc6378eb0d480bc5b60f2c18876f0bb2a97d (patch)
tree1d914b217a7374ed6315ef2f4d38e921689d3705 /server/lib
parent304016c52ba275a293a2c8ee3287e569b398dc68 (diff)
downloadPeerTube-7006bc6378eb0d480bc5b60f2c18876f0bb2a97d.tar.gz
PeerTube-7006bc6378eb0d480bc5b60f2c18876f0bb2a97d.tar.zst
PeerTube-7006bc6378eb0d480bc5b60f2c18876f0bb2a97d.zip
Fix actor followers/following counts
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/activitypub/actor.ts9
1 files changed, 3 insertions, 6 deletions
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) {
132 activityPub: true 132 activityPub: true
133 } 133 }
134 134
135 let requestResult
136 try { 135 try {
137 requestResult = await doRequest(options) 136 const { body } = await doRequest(options)
137 return body.totalItems ? body.totalItems : 0
138 } catch (err) { 138 } catch (err) {
139 logger.warn('Cannot fetch remote actor count %s.', url, err) 139 logger.warn('Cannot fetch remote actor count %s.', url, err)
140 return undefined 140 return 0
141 } 141 }
142
143 return requestResult.totalItems ? requestResult.totalItems : 0
144} 142}
145 143
146async function fetchAvatarIfExists (actorJSON: ActivityPubActor) { 144async function fetchAvatarIfExists (actorJSON: ActivityPubActor) {
@@ -314,7 +312,6 @@ async function refreshActorIfNeeded (actor: ActorModel) {
314 if (result === undefined) throw new Error('Cannot fetch remote actor in refresh actor.') 312 if (result === undefined) throw new Error('Cannot fetch remote actor in refresh actor.')
315 313
316 return sequelizeTypescript.transaction(async t => { 314 return sequelizeTypescript.transaction(async t => {
317 logger.info('coucou', result.actor.toJSON())
318 updateInstanceWithAnother(actor, result.actor) 315 updateInstanceWithAnother(actor, result.actor)
319 316
320 if (result.avatarName !== undefined) { 317 if (result.avatarName !== undefined) {