From 15516862ce3718630a876d461e99dedd3c15a8b0 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 24 Oct 2024 13:33:04 -0400 Subject: [PATCH] fix: federate out an Add on post creation even if there are no category followers --- src/api/activitypub.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/api/activitypub.js b/src/api/activitypub.js index 6adfa66363..57870db800 100644 --- a/src/api/activitypub.js +++ b/src/api/activitypub.js @@ -136,8 +136,8 @@ activitypubApi.create.note = enabledCheck(async (caller, { pid, post }) => { await activitypub.send('uid', caller.uid, Array.from(targets), payload); - if (followers.length) { - setTimeout(() => { // Delay sending to avoid potential race condition + setTimeout(() => { // Delay sending to avoid potential race condition + if (followers.length) { Promise.all([payload, payload.object].map(async (object) => { await activitypub.send('cid', cid, followers, { id: `${nconf.get('url')}/post/${encodeURIComponent(object.object ? object.object.id : object.id)}#activity/announce/${Date.now()}`, @@ -147,9 +147,9 @@ activitypubApi.create.note = enabledCheck(async (caller, { pid, post }) => { object, }); })).catch(err => winston.error(err.stack)); - activitypubApi.add(caller, { pid }); - }, 5000); - } + } + activitypubApi.add(caller, { pid }); + }, 5000); }); activitypubApi.create.privateNote = enabledCheck(async (caller, { messageObj }) => {