footer shows total topic post count

This commit is contained in:
Baris Usakli
2013-06-28 10:56:38 -04:00
parent 761d8fc508
commit aecffecdf1
5 changed files with 36 additions and 1 deletions

View File

@@ -201,6 +201,8 @@ marked.setOptions({
timeout: 2000
});
Posts.getTopicPostStats(socket);
// Send notifications to users who are following this topic
threadTools.notify_followers(tid, uid);
@@ -265,6 +267,8 @@ marked.setOptions({
RDB.zadd(schema.topics().recent, timestamp, tid);
RDB.set('tid:' + tid + ':lastposttime', timestamp);
RDB.incr('totalpostcount');
user.getUserFields(uid, ['username'], function(data) { // todo parallel
//add active users to this category
RDB.get('tid:' + tid + ':cid', function(err, cid) {
@@ -339,4 +343,19 @@ marked.setOptions({
});
}
Posts.getTopicPostStats = function(socket) {
RDB.mget(['totaltopiccount', 'totalpostcount'], function(err, data) {
if(err === null) {
var stats = {
topics: data[1]?data[1]:0,
posts: data[0]?data[0]:0
};
socket.emit('post.stats', stats);
}
else
console.log(err);
});
}
}(exports));