mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 22:45:46 +01:00
@@ -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);
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user