mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 09:06:15 +01:00
feat: remove /world/all route, add intro header to /world
This commit is contained in:
@@ -44,18 +44,10 @@
|
|||||||
{
|
{
|
||||||
"route": "/world",
|
"route": "/world",
|
||||||
"title": "[[global:header.world]]",
|
"title": "[[global:header.world]]",
|
||||||
"enabled": false,
|
"enabled": true,
|
||||||
"iconClass": "fa-circle-nodes",
|
|
||||||
"textClass": "d-lg-none",
|
|
||||||
"text": "[[global:header.world]]"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"route": "/world/all",
|
|
||||||
"title": "[[global:header.world-all]]",
|
|
||||||
"enabled": false,
|
|
||||||
"iconClass": "fa-globe",
|
"iconClass": "fa-globe",
|
||||||
"textClass": "d-lg-none",
|
"textClass": "d-lg-none",
|
||||||
"text": "[[global:header.world-all]]"
|
"text": "[[global:header.world]]"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"route": "/users",
|
"route": "/users",
|
||||||
|
|||||||
@@ -103,7 +103,7 @@
|
|||||||
"nodebb-plugin-ntfy": "1.7.4",
|
"nodebb-plugin-ntfy": "1.7.4",
|
||||||
"nodebb-plugin-spam-be-gone": "2.2.2",
|
"nodebb-plugin-spam-be-gone": "2.2.2",
|
||||||
"nodebb-rewards-essentials": "1.0.0",
|
"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-lavender": "7.1.8",
|
||||||
"nodebb-theme-peace": "2.2.4",
|
"nodebb-theme-peace": "2.2.4",
|
||||||
"nodebb-theme-persona": "13.3.18",
|
"nodebb-theme-persona": "13.3.18",
|
||||||
|
|||||||
@@ -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.",
|
"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",
|
"topic-event-announce-ago": "%1 shared <a href=\"%2\">this post</a> %3",
|
||||||
|
|||||||
@@ -56,8 +56,7 @@
|
|||||||
"header.navigation": "Navigation",
|
"header.navigation": "Navigation",
|
||||||
"header.manage": "Manage",
|
"header.manage": "Manage",
|
||||||
"header.drafts": "Drafts",
|
"header.drafts": "Drafts",
|
||||||
"header.world": "World (Curated)",
|
"header.world": "World",
|
||||||
"header.world-all": "World (All)",
|
|
||||||
|
|
||||||
"notifications.loading": "Loading Notifications",
|
"notifications.loading": "Loading Notifications",
|
||||||
"chats.loading": "Loading Chats",
|
"chats.loading": "Loading Chats",
|
||||||
|
|||||||
@@ -16,8 +16,7 @@ const intFields = [
|
|||||||
const worldCategory = {
|
const worldCategory = {
|
||||||
cid: -1,
|
cid: -1,
|
||||||
name: 'Uncategorized',
|
name: 'Uncategorized',
|
||||||
description: 'tbd',
|
description: 'Pseudo-category containing topics that do not strictly fit in with any existing categories',
|
||||||
descriptionParsed: 'tbd',
|
|
||||||
icon: 'fa-globe',
|
icon: 'fa-globe',
|
||||||
imageClass: 'cover',
|
imageClass: 'cover',
|
||||||
bgColor: '#eee',
|
bgColor: '#eee',
|
||||||
@@ -29,6 +28,7 @@ const worldCategory = {
|
|||||||
link: '',
|
link: '',
|
||||||
class: '', // todo
|
class: '', // todo
|
||||||
};
|
};
|
||||||
|
worldCategory.descriptionParsed = worldCategory.description;
|
||||||
|
|
||||||
module.exports = function (Categories) {
|
module.exports = function (Categories) {
|
||||||
Categories.getCategoriesFields = async function (cids, fields) {
|
Categories.getCategoriesFields = async function (cids, fields) {
|
||||||
|
|||||||
@@ -21,6 +21,10 @@ const validSorts = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
controller.list = async function (req, res) {
|
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 { topicsPerPage } = await user.getSettings(req.uid);
|
||||||
const page = parseInt(req.query.page, 10) || 1;
|
const page = parseInt(req.query.page, 10) || 1;
|
||||||
const start = Math.max(0, (page - 1) * topicsPerPage);
|
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 sort = validSorts.includes(req.query.sort) ? req.query.sort : userSettings.categoryTopicSort;
|
||||||
|
|
||||||
const sets = [sortToSet[sort], `uid:${req.uid}:inbox`];
|
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({
|
const tids = await db.getSortedSetRevIntersect({
|
||||||
sets,
|
sets,
|
||||||
start,
|
start,
|
||||||
@@ -69,6 +67,9 @@ controller.list = async function (req, res) {
|
|||||||
tag: req.query.tag,
|
tag: req.query.tag,
|
||||||
targetUid: targetUid,
|
targetUid: targetUid,
|
||||||
});
|
});
|
||||||
|
data.name = '[[activitypub:world.name]]';
|
||||||
|
data.description = '[[activitypub:world.description]]';
|
||||||
|
data.descriptionParsed = data.description;
|
||||||
delete data.children;
|
delete data.children;
|
||||||
|
|
||||||
data.topicCount = await db.sortedSetIntersectCard(sets);
|
data.topicCount = await db.sortedSetIntersectCard(sets);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
const helpers = require('./helpers');
|
const helpers = require('./helpers');
|
||||||
|
|
||||||
module.exports = function (app, middleware, controllers) {
|
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)
|
* 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