post count is incrementing when replying

v1.18.x
Baris Usakli 12 years ago
parent 430e65a352
commit 3c86b43ba3

@ -69,7 +69,7 @@ var RDB = require('./redis.js'),
Posts.reply = function(socket, tid, uid, content) {
Posts.create(uid, content, function(pid) {
Posts.create(uid, tid, content, function(pid) {
RDB.rpush('tid:' + tid + ':posts', pid);
socket.emit('event:alert', {
@ -81,7 +81,7 @@ var RDB = require('./redis.js'),
});
};
Posts.create = function(uid, content, callback) {
Posts.create = function(uid, tid, content, callback) {
if (uid === null) return;
RDB.incr('global:next_post_id', function(pid) {
@ -90,6 +90,8 @@ var RDB = require('./redis.js'),
RDB.set('pid:' + pid + ':uid', uid);
RDB.set('pid:' + pid + ':timestamp', new Date().getTime());
RDB.incr('tid:' + tid + ':postcount');
// User Details - move this out later
RDB.lpush('uid:' + uid + ':posts', pid);

@ -76,6 +76,8 @@ var RDB = require('./redis.js'),
slug = replies[3];
postcount = replies[4];
user.get_usernames_by_uids(uid, function(userNames) {
var topics = [];
@ -118,6 +120,7 @@ var RDB = require('./redis.js'),
}
RDB.incr('global:next_topic_id', function(tid) {
// Global Topics
if (uid == null) uid = 0;
if (uid !== null) {
@ -142,6 +145,8 @@ var RDB = require('./redis.js'),
RDB.set('tid:' + tid + ':timestamp', new Date().getTime());
RDB.incr('tid:' + tid + ':postcount');
RDB.set('topic:slug:' + slug + ':tid', tid);
// Posts

Loading…
Cancel
Save