feat: add line to description exposing a category's handle if accessible by fediverse pseudo-user, closes #13126

This commit is contained in:
Julian Lam
2025-03-03 15:03:06 -05:00
parent e3edfef865
commit 6c26d9f4a3
4 changed files with 14 additions and 3 deletions

View File

@@ -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",

View File

@@ -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?",

View File

@@ -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 });
};

View File

@@ -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 parsing
res.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);