mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-07 05:37:35 +02: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');
|
const sortOptionsEl = document.getElementById('sort-options');
|
||||||
if (sortLabelEl && sortOptionsEl) {
|
if (sortLabelEl && sortOptionsEl) {
|
||||||
const params = new URLSearchParams(window.location.search);
|
const params = new URLSearchParams(window.location.search);
|
||||||
if (params.get('sort') === 'popular') {
|
switch(params.get('sort')) {
|
||||||
translator.translate(`[[world:popular-${params.get('term')}]]`, function (translated) {
|
case 'popular': {
|
||||||
sortLabelEl.innerText = translated;
|
translator.translate(`[[world:popular-${params.get('term')}]]`, function (translated) {
|
||||||
});
|
sortLabelEl.innerText = translated;
|
||||||
} else {
|
});
|
||||||
translator.translate('[[world:latest]]', function (translated) {
|
break;
|
||||||
sortLabelEl.innerText = translated;
|
}
|
||||||
});
|
|
||||||
|
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;
|
const controller = module.exports;
|
||||||
|
|
||||||
controller.list = async function (req, res) {
|
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);
|
const { topicsPerPage } = await user.getSettings(req.uid);
|
||||||
let { page, after } = req.query;
|
let { page, after } = req.query;
|
||||||
page = parseInt(page, 10) || 1;
|
page = parseInt(page, 10) || 1;
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ module.exports = function (app, middleware, controllers) {
|
|||||||
helpers.setupPageRoute(app, '/world', [
|
helpers.setupPageRoute(app, '/world', [
|
||||||
middleware.activitypub.enabled,
|
middleware.activitypub.enabled,
|
||||||
middleware.activitypub.pageview,
|
middleware.activitypub.pageview,
|
||||||
middleware.ensureLoggedIn,
|
|
||||||
], controllers.activitypub.topics.list);
|
], controllers.activitypub.topics.list);
|
||||||
helpers.setupPageRoute(app, '/ap', [
|
helpers.setupPageRoute(app, '/ap', [
|
||||||
middleware.activitypub.enabled,
|
middleware.activitypub.enabled,
|
||||||
|
|||||||
Reference in New Issue
Block a user