Skip to content

Node.js based forum software built for the modern web

delete topic post sorted sets on topic purge

barisusakli23f450adbd42
diff --git a/src/topics/delete.js b/src/topics/delete.js
index eb4c6c43a0..de86eb7bbc 100644
--- a/src/topics/delete.js
+++ b/src/topics/delete.js
@@ -45,7 +45,11 @@ module.exports = function(Topics) {
Topics.purge = function(tid, callback) {
async.parallel([
function(next) {
- db.deleteAll(['tid:' + tid + ':followers', 'tid:' + tid + ':read_by_uid'], next);
+ db.deleteAll([
+ 'tid:' + tid + ':followers',
+ 'tid:' + tid + ':posts',
+ 'tid:' + tid + ':posts:votes'
+ ], next);
},
function(next) {
db.sortedSetsRemove(['topics:tid', 'topics:recent', 'topics:posts', 'topics:views'], tid, next);
diff --git a/src/topics/posts.js b/src/topics/posts.js
index 66fbb6bc4a..9e3275887f 100644
--- a/src/topics/posts.js
+++ b/src/topics/posts.js
@@ -218,14 +218,7 @@ module.exports = function(Topics) {
};
Topics.removePostFromTopic = function(tid, pid, callback) {
- async.parallel([
- function (next) {
- db.sortedSetRemove('tid:' + tid + ':posts', pid, next);
- },
- function (next) {
- db.sortedSetRemove('tid:' + tid + ':posts:votes', pid, next);
- }
- ], function(err, results) {
+ db.sortedSetsRemove(['tid:' + tid + ':posts', 'tid:' + tid + ':posts:votes'], pid, function(err) {
if (err) {
return callback(err);
}