Skip to content

Node.js based forum software built for the modern web

fix: handle missing orderedItems property in followers route

Julian Lame042201f4bc6
diff --git a/src/controllers/activitypub/index.js b/src/controllers/activitypub/index.js
index 0d9962ebf2..583d437ffb 100644
--- a/src/controllers/activitypub/index.js
+++ b/src/controllers/activitypub/index.js
@@ -95,13 +95,15 @@ Controller.getFollowers = async (req, res) => {
url: `${nconf.get('url')}/uid/${req.params.uid}/followers`,
});
- 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);
};