diff --git a/src/controllers/activitypub/index.js b/src/controllers/activitypub/index.js index 583d437ffb..36054d6616 100644 --- a/src/controllers/activitypub/index.js +++ b/src/controllers/activitypub/index.js @@ -71,13 +71,15 @@ Controller.getFollowing = async (req, res) => { url: `${nconf.get('url')}/uid/${req.params.uid}/following`, }); - collection.orderedItems = collection.orderedItems.map(({ uid }) => { - if (utils.isNumber(uid)) { - return `${nconf.get('url')}/uid/${uid}`; - } + if (collection.hasOwnProperty('orderedItems')) { + collection.orderedItems = collection.orderedItems.map(({ uid }) => { + if (utils.isNumber(uid)) { + return `${nconf.get('url')}/uid/${uid}`; + } - return uid; - }); + return uid; + }); + } res.status(200).json(collection); };