mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-16 10:46:14 +01:00
fix: #7788, fix on topic move and new post
This commit is contained in:
@@ -37,7 +37,7 @@ module.exports = function (Categories) {
|
||||
};
|
||||
|
||||
Categories.updateRecentTidForCid = async function (cid) {
|
||||
let recentTid;
|
||||
let postData;
|
||||
let topicData;
|
||||
let index = 0;
|
||||
do {
|
||||
@@ -46,16 +46,16 @@ module.exports = function (Categories) {
|
||||
if (!pids.length) {
|
||||
return;
|
||||
}
|
||||
recentTid = await posts.getPostField(pids[0], 'tid');
|
||||
if (!recentTid) {
|
||||
return;
|
||||
postData = await posts.getPostFields(pids[0], ['tid', 'deleted']);
|
||||
|
||||
if (postData && postData.tid && !postData.deleted) {
|
||||
topicData = await topics.getTopicData(postData.tid);
|
||||
}
|
||||
topicData = await topics.getTopicData(recentTid);
|
||||
index += 1;
|
||||
} while (!topicData || topicData.deleted);
|
||||
|
||||
if (recentTid) {
|
||||
await Categories.updateRecentTid(cid, recentTid);
|
||||
if (postData && postData.tid) {
|
||||
await Categories.updateRecentTid(cid, postData.tid);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user