mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-16 13:30:23 +01:00
feat: notice on remote categories that have no local followers, #13255
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user