From 0c55417df224e2afd0d11149bc7ea2e4dcc176ce Mon Sep 17 00:00:00 2001 From: psychobunny Date: Tue, 8 Jul 2014 12:37:31 -0400 Subject: [PATCH] purge topic if it's the post is purged in that topic --- src/posts/delete.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/posts/delete.js b/src/posts/delete.js index 3fe36abf8e..c2edb7992b 100644 --- a/src/posts/delete.js +++ b/src/posts/delete.js @@ -49,6 +49,15 @@ module.exports = function(Posts) { }, function(next) { db.sortedSetRemove('uid:' + postData.uid + ':posts', pid, next); + }, + function(next) { + db.setCount('tid:' + postData.tid + ':posts', function(err, count) { + if (count === 0) { + topics.purge(postData.tid, next); + } else { + next(); + } + }); } ], function(err) { if (err) {