mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-22 20:32:28 +01:00
fix: restore guest access to /world, default to latest(all)
This commit is contained in:
@@ -36,14 +36,21 @@ define('forum/world', [
|
||||
const sortOptionsEl = document.getElementById('sort-options');
|
||||
if (sortLabelEl && sortOptionsEl) {
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
if (params.get('sort') === 'popular') {
|
||||
translator.translate(`[[world:popular-${params.get('term')}]]`, function (translated) {
|
||||
sortLabelEl.innerText = translated;
|
||||
});
|
||||
} else {
|
||||
translator.translate('[[world:latest]]', function (translated) {
|
||||
sortLabelEl.innerText = translated;
|
||||
});
|
||||
switch(params.get('sort')) {
|
||||
case 'popular': {
|
||||
translator.translate(`[[world:popular-${params.get('term')}]]`, function (translated) {
|
||||
sortLabelEl.innerText = translated;
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
console.log('here!');
|
||||
translator.translate(`[[world:latest${params.get('all') === '1' ? '-all' : ''}]]`, function (translated) {
|
||||
sortLabelEl.innerText = translated;
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,10 @@ const helpers = require('../helpers');
|
||||
const controller = module.exports;
|
||||
|
||||
controller.list = async function (req, res) {
|
||||
if (!req.uid && !req.query.sort && !req.query.all) {
|
||||
return helpers.redirect(res, '/world?all=1', false);
|
||||
}
|
||||
|
||||
const { topicsPerPage } = await user.getSettings(req.uid);
|
||||
let { page, after } = req.query;
|
||||
page = parseInt(page, 10) || 1;
|
||||
|
||||
@@ -6,7 +6,6 @@ module.exports = function (app, middleware, controllers) {
|
||||
helpers.setupPageRoute(app, '/world', [
|
||||
middleware.activitypub.enabled,
|
||||
middleware.activitypub.pageview,
|
||||
middleware.ensureLoggedIn,
|
||||
], controllers.activitypub.topics.list);
|
||||
helpers.setupPageRoute(app, '/ap', [
|
||||
middleware.activitypub.enabled,
|
||||
|
||||
Reference in New Issue
Block a user