fix: #7788 No new posts (#7793)

* feat: debug no-new-posts

* feat: add test for user delete

* fix: timeout for flag test

* feat: shorter
This commit is contained in:
Barış Soner Uşaklı
2019-07-23 21:11:04 -04:00
committed by GitHub
parent e76214a25c
commit 3c32d8600f
6 changed files with 50 additions and 11 deletions

View File

@@ -29,7 +29,8 @@ module.exports = function (Categories) {
return await db.sortedSetAdd('cid:' + cid + ':recent_tids', Date.now(), tid);
}
const data = await db.getSortedSetRangeWithScores('cid:' + cid + ':recent_tids', 0, count - numRecentReplies);
if (data.length) {
const shouldRemove = !(data.length === 1 && count === 1 && data[0].value === String(tid));
if (data.length && shouldRemove) {
await db.sortedSetsRemoveRangeByScore(['cid:' + cid + ':recent_tids'], '-inf', data[data.length - 1].score);
}
await db.sortedSetAdd('cid:' + cid + ':recent_tids', Date.now(), tid);