From 8496e1efbb817a725ad9cd0a49402eb0af02038a Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 11 Mar 2026 17:46:57 -0400 Subject: [PATCH] fix: missing orderedItems on category outbox index retrieval --- src/controllers/activitypub/index.js | 36 +++++++++++++++------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/controllers/activitypub/index.js b/src/controllers/activitypub/index.js index db1441aa1b..22da06cf6c 100644 --- a/src/controllers/activitypub/index.js +++ b/src/controllers/activitypub/index.js @@ -226,24 +226,26 @@ Controller.getCategoryOutbox = async (req, res) => { perPage: 20, url: `${nconf.get('url')}/category/1/outbox`, }); - collection.orderedItems = await Promise.all(collection.orderedItems.map(async (pid) => { - let object; - if (utils.isNumber(pid)) { - const { activity } = await activitypub.mocks.activities.create(pid, 0); - object = activity; - } else { - object = pid; - } + if (collection.orderedItems) { + collection.orderedItems = await Promise.all(collection.orderedItems.map(async (pid) => { + let object; + if (utils.isNumber(pid)) { + const { activity } = await activitypub.mocks.activities.create(pid, 0); + object = activity; + } else { + object = pid; + } - return { - id: `${nconf.get('url')}/post/${encodeURIComponent(pid)}#activity/announce/cid/${cid}`, - type: 'Announce', - actor: `${nconf.get('url')}/category/${cid}`, - to: [activitypub._constants.publicAddress], - cc: [`${nconf.get('url')}/category/${cid}/followers`], - object, - }; - })); + return { + id: `${nconf.get('url')}/post/${encodeURIComponent(pid)}#activity/announce/cid/${cid}`, + type: 'Announce', + actor: `${nconf.get('url')}/category/${cid}`, + to: [activitypub._constants.publicAddress], + cc: [`${nconf.get('url')}/category/${cid}/followers`], + object, + }; + })); + } res.status(200).json({ '@context': 'https://www.w3.org/ns/activitystreams',