From 16f8f536da4d3d12e1192dce20ea985652bafcf9 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Fri, 21 Jun 2024 16:46:33 -0400 Subject: [PATCH] fix: do not retrieve remote outbox count when asserting actor This change means that a remote user's post count is only the number of posts they have stored locally. This is easier to reconcile with the profile UI since showing the artificial number could cause issues if the local instance contains fewer or no posts by that user. fixes #12646 --- src/activitypub/actors.js | 9 --------- src/activitypub/mocks.js | 3 +-- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/src/activitypub/actors.js b/src/activitypub/actors.js index eee79bef14..327f6da42c 100644 --- a/src/activitypub/actors.js +++ b/src/activitypub/actors.js @@ -101,15 +101,6 @@ Actors.assert = async (ids, options = {}) => { // winston.verbose(`[activitypub/actor.assert] Unable to retrieve follower counts for ${actor.id}`); } - // Post count - try { - const outbox = actor.outbox ? await activitypub.get('uid', 0, actor.outbox) : { totalItems: 0 }; - actor.postcount = outbox.totalItems; - } catch (e) { - // no action required - // winston.verbose(`[activitypub/actor.assert] Unable to retrieve post counts for ${actor.id}`); - } - // Save url for backreference const url = Array.isArray(actor.url) ? actor.url.shift() : actor.url; if (url && url !== actor.id) { diff --git a/src/activitypub/mocks.js b/src/activitypub/mocks.js index 9e189d8c1c..b08595255d 100644 --- a/src/activitypub/mocks.js +++ b/src/activitypub/mocks.js @@ -39,7 +39,7 @@ Mocks.profile = async (actors) => { let { url, preferredUsername, published, icon, image, name, summary, followers, followerCount, followingCount, - postcount, inbox, endpoints, + inbox, endpoints, } = actor; preferredUsername = preferredUsername || slugify(name); @@ -68,7 +68,6 @@ Mocks.profile = async (actors) => { 'cover:url': !image || typeof image === 'string' ? image : image.url, 'cover:position': '50% 50%', aboutme: summary, - postcount, followerCount, followingCount,