closed , closed

v1.18.x
Julian Lam
parent 4416f8530d
commit f1b4367168

@ -109,6 +109,7 @@ var RDB = require('./redis.js'),
postSearch.remove(pid);
posts.getPostFields(pid, ['tid', 'uid'], function(postData) {
RDB.hincrby('topic:'+postData.tid, 'postcount', -1);
user.decrementUserFieldBy(postData.uid, 'postcount', 1, function(err, postcount) {
RDB.zadd('users:postcount', postcount, postData.uid);
@ -145,6 +146,7 @@ var RDB = require('./redis.js'),
posts.setPostField(pid, 'deleted', 0);
posts.getPostFields(pid, ['tid', 'uid', 'content'], function(postData) {
RDB.hincrby('topic:'+postData.tid, 'postcount', 1);
user.incrementUserFieldBy(postData.uid, 'postcount', 1);
@ -158,6 +160,13 @@ var RDB = require('./redis.js'),
});
});
// Restore topic if it is the only post
topics.getTopicField(postData.tid, 'postcount', function(err, count) {
if (count === '1') {
threadTools.restore(postData.tid, uid);
}
});
postSearch.index(postData.content, pid);
});
};

Loading…
Cancel
Save