mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-06 14:05:46 +01:00
feat: move postercount to topic hash
This commit is contained in:
@@ -174,6 +174,8 @@ module.exports = function (Topics) {
|
||||
}
|
||||
await Topics.increasePostCount(tid);
|
||||
await db.sortedSetIncrBy('tid:' + tid + ':posters', 1, postData.uid);
|
||||
const posterCount = await db.sortedSetCard('tid:' + tid + ':posters');
|
||||
await Topics.setTopicField(tid, 'postercount', posterCount);
|
||||
await Topics.updateTeaser(tid);
|
||||
};
|
||||
|
||||
@@ -184,6 +186,9 @@ module.exports = function (Topics) {
|
||||
], postData.pid);
|
||||
await Topics.decreasePostCount(tid);
|
||||
await db.sortedSetIncrBy('tid:' + tid + ':posters', -1, postData.uid);
|
||||
await db.sortedSetsRemoveRangeByScore(['tid:' + tid + ':posters'], '-inf', 0);
|
||||
const posterCount = await db.sortedSetCard('tid:' + tid + ':posters');
|
||||
await Topics.setTopicField(tid, 'postercount', posterCount);
|
||||
await Topics.updateTeaser(tid);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user