From af324dae55bf5ffa59e168b4f08293b2bdb67c5e Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 25 Apr 2024 15:46:55 -0400 Subject: [PATCH] feat: remove `/world/all` route, add intro header to `/world` --- install/data/navigation.json | 12 ++---------- install/package.json | 2 +- public/language/en-GB/activitypub.json | 4 +++- public/language/en-GB/global.json | 3 +-- src/categories/data.js | 4 ++-- src/controllers/activitypub/topics.js | 13 +++++++------ src/routes/activitypub.js | 2 +- 7 files changed, 17 insertions(+), 23 deletions(-) diff --git a/install/data/navigation.json b/install/data/navigation.json index 76adaf7cea..0532dae545 100644 --- a/install/data/navigation.json +++ b/install/data/navigation.json @@ -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", diff --git a/install/package.json b/install/package.json index 4fe45ceb38..6f80972818 100644 --- a/install/package.json +++ b/install/package.json @@ -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", diff --git a/public/language/en-GB/activitypub.json b/public/language/en-GB/activitypub.json index 36212751ae..82f562a812 100644 --- a/public/language/en-GB/activitypub.json +++ b/public/language/en-GB/activitypub.json @@ -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 this post %3", diff --git a/public/language/en-GB/global.json b/public/language/en-GB/global.json index 1ac087f617..c947bb92ae 100644 --- a/public/language/en-GB/global.json +++ b/public/language/en-GB/global.json @@ -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", diff --git a/src/categories/data.js b/src/categories/data.js index a1b0093363..d0bec60f9c 100644 --- a/src/categories/data.js +++ b/src/categories/data.js @@ -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) { diff --git a/src/controllers/activitypub/topics.js b/src/controllers/activitypub/topics.js index 87afe4862c..7022ba5ae9 100644 --- a/src/controllers/activitypub/topics.js +++ b/src/controllers/activitypub/topics.js @@ -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); diff --git a/src/routes/activitypub.js b/src/routes/activitypub.js index bcdf631e04..9f32715ebc 100644 --- a/src/routes/activitypub.js +++ b/src/routes/activitypub.js @@ -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)