feat: remove /world/all route, add intro header to /world

This commit is contained in:
Julian Lam
2024-04-25 15:46:55 -04:00
parent 7180819c21
commit af324dae55
7 changed files with 17 additions and 23 deletions

View File

@@ -44,18 +44,10 @@
{
"route": "/world",
"title": "[[global:header.world]]",
"enabled": false,
"iconClass": "fa-circle-nodes",
"textClass": "d-lg-none",
"text": "[[global:header.world]]"
},
{
"route": "/world/all",
"title": "[[global:header.world-all]]",
"enabled": false,
"enabled": true,
"iconClass": "fa-globe",
"textClass": "d-lg-none",
"text": "[[global:header.world-all]]"
"text": "[[global:header.world]]"
},
{
"route": "/users",

View File

@@ -103,7 +103,7 @@
"nodebb-plugin-ntfy": "1.7.4",
"nodebb-plugin-spam-be-gone": "2.2.2",
"nodebb-rewards-essentials": "1.0.0",
"nodebb-theme-harmony": "2.0.0-pre.17",
"nodebb-theme-harmony": "2.0.0-pre.18",
"nodebb-theme-lavender": "7.1.8",
"nodebb-theme-peace": "2.2.4",
"nodebb-theme-persona": "13.3.18",

View File

@@ -1,5 +1,7 @@
{
"category.name": "World",
"world.name": "World",
"world.description": "This forum is federated, and can interact with the social web (or \"fediverse\"). Your corner of the fediverse consists of topics created by — and shared from — from users you follow.",
"world.popular": "Popular topics from the past day",
"no-topics": "This forum doesn't know of any other topics yet.",
"topic-event-announce-ago": "%1 shared <a href=\"%2\">this post</a> %3",

View File

@@ -56,8 +56,7 @@
"header.navigation": "Navigation",
"header.manage": "Manage",
"header.drafts": "Drafts",
"header.world": "World (Curated)",
"header.world-all": "World (All)",
"header.world": "World",
"notifications.loading": "Loading Notifications",
"chats.loading": "Loading Chats",

View File

@@ -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) {

View File

@@ -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);

View File

@@ -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)