mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
feat: add number of posters to topic
This commit is contained in:
@@ -3542,6 +3542,9 @@ paths:
|
||||
type: number
|
||||
viewcount:
|
||||
type: number
|
||||
posterCount:
|
||||
type: number
|
||||
description: The number of unique users who made a post in this topic
|
||||
mainPid:
|
||||
type: number
|
||||
description: The post id of the first post in this topic (also called the
|
||||
|
||||
@@ -146,6 +146,7 @@ Topics.getTopicWithPosts = async function (topicData, set, uid, start, stop, rev
|
||||
deleter,
|
||||
merger,
|
||||
related,
|
||||
posterCount,
|
||||
] = await Promise.all([
|
||||
getMainPostAndReplies(topicData, set, uid, start, stop, reverse),
|
||||
categories.getCategoryData(topicData.cid),
|
||||
@@ -157,6 +158,7 @@ Topics.getTopicWithPosts = async function (topicData, set, uid, start, stop, rev
|
||||
getDeleter(topicData),
|
||||
getMerger(topicData),
|
||||
getRelated(topicData, uid),
|
||||
db.sortedSetCard('tid:' + topicData.tid + ':posters'),
|
||||
]);
|
||||
|
||||
topicData.posts = posts;
|
||||
@@ -179,6 +181,7 @@ Topics.getTopicWithPosts = async function (topicData, set, uid, start, stop, rev
|
||||
topicData.mergedTimestampISO = utils.toISOString(topicData.mergedTimestamp);
|
||||
}
|
||||
topicData.related = related || [];
|
||||
topicData.posterCount = posterCount;
|
||||
topicData.unreplied = topicData.postcount === 1;
|
||||
topicData.icons = [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user