diff --git a/public/src/client/world.js b/public/src/client/world.js index ca9fda9187..b22813162b 100644 --- a/public/src/client/world.js +++ b/public/src/client/world.js @@ -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; + } } } diff --git a/src/controllers/activitypub/topics.js b/src/controllers/activitypub/topics.js index 702893cac8..8785fecc14 100644 --- a/src/controllers/activitypub/topics.js +++ b/src/controllers/activitypub/topics.js @@ -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; diff --git a/src/routes/activitypub.js b/src/routes/activitypub.js index 00d8b1a125..6c13fea365 100644 --- a/src/routes/activitypub.js +++ b/src/routes/activitypub.js @@ -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,