mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-17 22:10: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",
|
"new-topic-button": "New Topic",
|
||||||
"guest-login-post": "Log in to post",
|
"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-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",
|
"browsing": "browsing",
|
||||||
"no-replies": "No one has replied",
|
"no-replies": "No one has replied",
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ const user = require('../user');
|
|||||||
const topics = require('../topics');
|
const topics = require('../topics');
|
||||||
const plugins = require('../plugins');
|
const plugins = require('../plugins');
|
||||||
const privileges = require('../privileges');
|
const privileges = require('../privileges');
|
||||||
|
const activitypub = require('../activitypub');
|
||||||
const cache = require('../cache');
|
const cache = require('../cache');
|
||||||
const meta = require('../meta');
|
const meta = require('../meta');
|
||||||
const utils = require('../utils');
|
const utils = require('../utils');
|
||||||
@@ -57,12 +58,13 @@ Categories.getCategoryById = async function (data) {
|
|||||||
Categories.getTopicCount(data),
|
Categories.getTopicCount(data),
|
||||||
Categories.getWatchState([data.cid], data.uid),
|
Categories.getWatchState([data.cid], data.uid),
|
||||||
getChildrenTree(category, data.uid),
|
getChildrenTree(category, data.uid),
|
||||||
|
!utils.isNumber(data.cid) ? activitypub.actors.getLocalFollowers(data.cid) : null,
|
||||||
];
|
];
|
||||||
|
|
||||||
if (category.parentCid) {
|
if (category.parentCid) {
|
||||||
promises.push(Categories.getCategoryData(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.topics = topics.topics;
|
||||||
category.nextStart = topics.nextStart;
|
category.nextStart = topics.nextStart;
|
||||||
@@ -71,6 +73,7 @@ Categories.getCategoryById = async function (data) {
|
|||||||
category.isTracked = watchState[0] === Categories.watchStates.tracking;
|
category.isTracked = watchState[0] === Categories.watchStates.tracking;
|
||||||
category.isNotWatched = watchState[0] === Categories.watchStates.notwatching;
|
category.isNotWatched = watchState[0] === Categories.watchStates.notwatching;
|
||||||
category.isIgnored = watchState[0] === Categories.watchStates.ignoring;
|
category.isIgnored = watchState[0] === Categories.watchStates.ignoring;
|
||||||
|
category.hasFollowers = localFollowers ? (localFollowers.uids.size + localFollowers.cids.size) > 0 : localFollowers;
|
||||||
category.parent = parent;
|
category.parent = parent;
|
||||||
|
|
||||||
calculateTopicPostCount(category);
|
calculateTopicPostCount(category);
|
||||||
|
|||||||
Reference in New Issue
Block a user