mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-08-26 20:57:34 +02:00
feat: remove /world/all route, add intro header to /world
This commit is contained in:
@@ -16,8 +16,7 @@ const intFields = [
|
||||
const worldCategory = {
|
||||
cid: -1,
|
||||
name: 'Uncategorized',
|
||||
description: 'tbd',
|
||||
descriptionParsed: 'tbd',
|
||||
description: 'Pseudo-category containing topics that do not strictly fit in with any existing categories',
|
||||
icon: 'fa-globe',
|
||||
imageClass: 'cover',
|
||||
bgColor: '#eee',
|
||||
@@ -29,6 +28,7 @@ const worldCategory = {
|
||||
link: '',
|
||||
class: '', // todo
|
||||
};
|
||||
worldCategory.descriptionParsed = worldCategory.description;
|
||||
|
||||
module.exports = function (Categories) {
|
||||
Categories.getCategoriesFields = async function (cids, fields) {
|
||||
|
||||
@@ -21,6 +21,10 @@ const validSorts = [
|
||||
];
|
||||
|
||||
controller.list = async function (req, res) {
|
||||
if (!req.uid) {
|
||||
return helpers.redirect(res, '/recent?cid=-1', false);
|
||||
}
|
||||
|
||||
const { topicsPerPage } = await user.getSettings(req.uid);
|
||||
const page = parseInt(req.query.page, 10) || 1;
|
||||
const start = Math.max(0, (page - 1) * topicsPerPage);
|
||||
@@ -43,12 +47,6 @@ controller.list = async function (req, res) {
|
||||
const sort = validSorts.includes(req.query.sort) ? req.query.sort : userSettings.categoryTopicSort;
|
||||
|
||||
const sets = [sortToSet[sort], `uid:${req.uid}:inbox`];
|
||||
if (req.params.filter === 'all' || !req.uid) {
|
||||
sets.pop();
|
||||
} else if (req.params.filter) {
|
||||
return helpers.redirect(res, '/world', false);
|
||||
}
|
||||
|
||||
const tids = await db.getSortedSetRevIntersect({
|
||||
sets,
|
||||
start,
|
||||
@@ -69,6 +67,9 @@ controller.list = async function (req, res) {
|
||||
tag: req.query.tag,
|
||||
targetUid: targetUid,
|
||||
});
|
||||
data.name = '[[activitypub:world.name]]';
|
||||
data.description = '[[activitypub:world.description]]';
|
||||
data.descriptionParsed = data.description;
|
||||
delete data.children;
|
||||
|
||||
data.topicCount = await db.sortedSetIntersectCard(sets);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
const helpers = require('./helpers');
|
||||
|
||||
module.exports = function (app, middleware, controllers) {
|
||||
helpers.setupPageRoute(app, '/world/:filter?', [middleware.activitypub.enabled], controllers.activitypub.topics.list);
|
||||
helpers.setupPageRoute(app, '/world', [middleware.activitypub.enabled], controllers.activitypub.topics.list);
|
||||
|
||||
/**
|
||||
* These controllers only respond if the sender is making an json+activitypub style call (i.e. S2S-only)
|
||||
|
||||
Reference in New Issue
Block a user