Node.js based forum software built for the modern web
feat: add line to description exposing a category's handle if accessible by fediverse pseudo-user, closes #13126
Julian Lam6c26d9f4a3c3
diff --git a/install/package.json b/install/package.jsonindex e9c8cf491d..4a2e29d5e2 100644--- a/install/package.json+++ b/install/package.json@@ -108,7 +108,7 @@"nodebb-plugin-spam-be-gone": "2.3.1","nodebb-plugin-web-push": "0.7.3","nodebb-rewards-essentials": "1.0.1",- "nodebb-theme-harmony": "2.0.37",+ "nodebb-theme-harmony": "2.0.38","nodebb-theme-lavender": "7.1.17","nodebb-theme-peace": "2.2.39","nodebb-theme-persona": "14.0.15",@@ -200,4 +200,4 @@"url": "https://github.com/barisusakli"}]-}\ No newline at end of file+}diff --git a/public/language/en-GB/category.json b/public/language/en-GB/category.jsonindex f6cea780cb..a0498414fb 100644--- a/public/language/en-GB/category.json+++ b/public/language/en-GB/category.json@@ -3,6 +3,7 @@"subcategories": "Subcategories","uncategorized": "Uncategorized","uncategorized.description": "Topics that do not strictly fit in with any existing categories",+ "handle.description": "This category can be followed from the open social web via the handle %1","new-topic-button": "New Topic","guest-login-post": "Log in to post","no-topics": "<strong>There are no topics in this category.</strong><br />Why don't you try posting one?",diff --git a/public/src/client/category.js b/public/src/client/category.jsindex 14eca6f6d7..a2a5d579ad 100644--- a/public/src/client/category.js+++ b/public/src/client/category.js@@ -10,7 +10,8 @@ define('forum/category', ['hooks','alerts','api',-], function (infinitescroll, share, navigator, topicList, sort, categorySelector, hooks, alerts, api) {+ 'clipboard',+], function (infinitescroll, share, navigator, topicList, sort, categorySelector, hooks, alerts, api, clipboard) {const Category = {};$(window).on('action:ajaxify.start', function (ev, data) {@@ -48,6 +49,8 @@ define('forum/category', [},});+ new clipboard('[data-clipboard-text]');+hooks.fire('action:topics.loaded', { topics: ajaxify.data.topics });hooks.fire('action:category.loaded', { cid: ajaxify.data.cid });};diff --git a/src/controllers/category.js b/src/controllers/category.jsindex fb2556dd78..27b5c749f9 100644--- a/src/controllers/category.js+++ b/src/controllers/category.js@@ -10,6 +10,7 @@ const privileges = require('../privileges');const user = require('../user');const categories = require('../categories');const meta = require('../meta');+const activitypub = require('../activitypub');const pagination = require('../pagination');const helpers = require('./helpers');const utils = require('../utils');@@ -161,6 +162,12 @@ categoryController.get = async function (req, res, next) {if (meta.config.activitypubEnabled) {// Include link header for richer parsingres.set('Link', `<${nconf.get('url')}/actegory/${cid}>; rel="alternate"; type="application/activity+json"`);++ // Category accessible+ const remoteOk = await privileges.categories.can('read', cid, activitypub._constants.uid);+ if (remoteOk) {+ categoryData.handleFull = `${categoryData.handle}@${nconf.get('url_parsed').host}`;+ }}res.render('category', categoryData);