Skip to content

Node.js based forum software built for the modern web

update category topic count if topic is deleted/restored

Baris Usaklidee99c175229
diff --git a/src/topics.js b/src/topics.js
index ed73a06c58..ec86fde245 100644
--- a/src/topics.js
+++ b/src/topics.js
@@ -788,6 +788,7 @@ var RDB = require('./redis.js'),
Topics.getTopicField(tid, 'cid', function(err, cid) {
feed.updateCategory(cid);
+ RDB.hincrby('category:' + cid, 'topic_count', -1);
});
}
@@ -799,6 +800,7 @@ var RDB = require('./redis.js'),
Topics.getTopicField(tid, 'cid', function(err, cid) {
feed.updateCategory(cid);
+ RDB.hincrby('category:' + cid, 'topic_count', 1);
});
}