Node.js based forum software built for the modern web
feat: notice on remote categories that have no local followers, #13255
Julian Lam93a5b35f3307
diff --git a/public/language/en-GB/category.json b/public/language/en-GB/category.jsonindex a0498414fb..faa58d2406 100644--- a/public/language/en-GB/category.json+++ b/public/language/en-GB/category.json@@ -7,6 +7,7 @@"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?",+ "no-followers": "Nobody on this website is tracking or watching this category. Track or watch this category in order to begin receiving updates.","browsing": "browsing","no-replies": "No one has replied",diff --git a/src/categories/index.js b/src/categories/index.jsindex 1a254f9b15..308516cd97 100644--- a/src/categories/index.js+++ b/src/categories/index.js@@ -8,6 +8,7 @@ const user = require('../user');const topics = require('../topics');const plugins = require('../plugins');const privileges = require('../privileges');+const activitypub = require('../activitypub');const cache = require('../cache');const meta = require('../meta');const utils = require('../utils');@@ -57,12 +58,13 @@ Categories.getCategoryById = async function (data) {Categories.getTopicCount(data),Categories.getWatchState([data.cid], data.uid),getChildrenTree(category, data.uid),+ !utils.isNumber(data.cid) ? activitypub.actors.getLocalFollowers(data.cid) : null,];if (category.parentCid) {promises.push(Categories.getCategoryData(category.parentCid));}- const [topics, topicCount, watchState, , parent] = await Promise.all(promises);+ const [topics, topicCount, watchState, , localFollowers, parent] = await Promise.all(promises);category.topics = topics.topics;category.nextStart = topics.nextStart;@@ -71,6 +73,7 @@ Categories.getCategoryById = async function (data) {category.isTracked = watchState[0] === Categories.watchStates.tracking;category.isNotWatched = watchState[0] === Categories.watchStates.notwatching;category.isIgnored = watchState[0] === Categories.watchStates.ignoring;+ category.hasFollowers = localFollowers ? (localFollowers.uids.size + localFollowers.cids.size) > 0 : localFollowers;category.parent = parent;calculateTopicPostCount(category);