Skip to content

Commit

Permalink
feat: remove /world/all route, add intro header to /world
Browse files Browse the repository at this point in the history
  • Loading branch information
julianlam committed Apr 25, 2024
1 parent 7180819 commit af324da
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 23 deletions.
12 changes: 2 additions & 10 deletions install/data/navigation.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion install/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 3 additions & 1 deletion public/language/en-GB/activitypub.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
3 changes: 1 addition & 2 deletions public/language/en-GB/global.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/categories/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -29,6 +28,7 @@ const worldCategory = {
link: '',
class: '', // todo
};
worldCategory.descriptionParsed = worldCategory.description;

module.exports = function (Categories) {
Categories.getCategoriesFields = async function (cids, fields) {
Expand Down
13 changes: 7 additions & 6 deletions src/controllers/activitypub/topics.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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,
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/routes/activitypub.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit af324da

Please sign in to comment.