From dee99c175229d39e41b1d3bb946cc8a238e07c3f Mon Sep 17 00:00:00 2001
From: Baris Usakli <barisusakli@gmail.com>
Date: Wed, 16 Oct 2013 13:42:07 -0400
Subject: [PATCH] update category topic count if topic is deleted/restored

---
 src/topics.js | 2 ++
 1 file changed, 2 insertions(+)

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);
 		});
 	}