Node.js based forum software built for the modern web
fix: events for just topic with main post
Barış Soner Uşaklı3d611ab70eb9
diff --git a/src/topics/index.js b/src/topics/index.jsindex ddc432bfd4..06a6879c6c 100644--- a/src/topics/index.js+++ b/src/topics/index.js@@ -254,9 +254,12 @@ Topics.addNextPostTimestamp = async function (postData, set, reverse) {}});const lastPost = postData[postData.length - 1];- if (lastPost && lastPost.index) {- const data = await db[reverse ? 'getSortedSetRevRangeWithScores' : 'getSortedSetRangeWithScores'](set, lastPost.index, lastPost.index);- lastPost.nextPostTimestamp = data.length ? data[0].score : Date.now();+ 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 : lastPost.nextPostTimestamp;+ }}};