Skip to content

Node.js based forum software built for the modern web

purge topic if it's the post is purged in that topic

psychobunny0c55417df224
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) {