Node.js based forum software built for the modern web
fix: circular object ref.
Julian Lam7af071514675
diff --git a/src/categories/data.js b/src/categories/data.jsindex 22fcc9532a..92ed1e64f5 100644--- a/src/categories/data.js+++ b/src/categories/data.js@@ -38,7 +38,11 @@ module.exports = function (Categories) {// Handle cid -1if (cids.includes(-1)) {- categories.splice(cids.indexOf(-1), 1, worldCategory);+ const subset = fields.reduce((category, field) => {+ category[field] = worldCategory[field] || undefined;+ return category;+ }, {});+ categories.splice(cids.indexOf(-1), 1, subset);}const result = await plugins.hooks.fire('filter:category.getFields', {diff --git a/src/controllers/category.js b/src/controllers/category.jsindex 487ea21cce..e969e95265 100644--- a/src/controllers/category.js+++ b/src/controllers/category.js@@ -26,6 +26,9 @@ const validSorts = [categoryController.get = async function (req, res, next) {const cid = req.params.category_id;+ if (cid === '-1') {+ return helpers.redirect(res, `/world?${qs.stringify(req.query)}`);+ }let currentPage = parseInt(req.query.page, 10) || 1;let topicIndex = utils.isNumber(req.params.topic_index) ? parseInt(req.params.topic_index, 10) - 1 : 0;