mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: events for just topic with main post
This commit is contained in:
@@ -254,9 +254,12 @@ Topics.addNextPostTimestamp = async function (postData, set, reverse) {
|
||||
}
|
||||
});
|
||||
const lastPost = postData[postData.length - 1];
|
||||
if (lastPost && lastPost.index) {
|
||||
if (lastPost) {
|
||||
lastPost.nextPostTimestamp = Date.now();
|
||||
if (lastPost.index) {
|
||||
const data = await db[reverse ? 'getSortedSetRevRangeWithScores' : 'getSortedSetRangeWithScores'](set, lastPost.index, lastPost.index);
|
||||
lastPost.nextPostTimestamp = data.length ? data[0].score : Date.now();
|
||||
lastPost.nextPostTimestamp = data.length ? data[0].score : lastPost.nextPostTimestamp;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user