mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-09 07:25:46 +01:00
closes #1022
This commit is contained in:
@@ -65,8 +65,6 @@ var winston = require('winston'),
|
|||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
db.decrObjectField('global', 'topicCount');
|
|
||||||
|
|
||||||
ThreadTools.lock(tid);
|
ThreadTools.lock(tid);
|
||||||
|
|
||||||
Plugins.fireHook('action:topic.delete', tid);
|
Plugins.fireHook('action:topic.delete', tid);
|
||||||
@@ -101,10 +99,10 @@ var winston = require('winston'),
|
|||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
db.incrObjectField('global', 'topicCount');
|
|
||||||
|
|
||||||
ThreadTools.unlock(tid);
|
ThreadTools.unlock(tid);
|
||||||
|
|
||||||
|
Plugins.fireHook('action:topic.restore', tid);
|
||||||
|
|
||||||
events.logTopicRestore(uid, tid);
|
events.logTopicRestore(uid, tid);
|
||||||
|
|
||||||
websockets.emitTopicPostStats();
|
websockets.emitTopicPostStats();
|
||||||
@@ -113,8 +111,6 @@ var winston = require('winston'),
|
|||||||
tid: tid
|
tid: tid
|
||||||
});
|
});
|
||||||
|
|
||||||
Plugins.fireHook('action:topic.restore', tid);
|
|
||||||
|
|
||||||
callback(null, {
|
callback(null, {
|
||||||
tid:tid
|
tid:tid
|
||||||
});
|
});
|
||||||
@@ -134,7 +130,7 @@ var winston = require('winston'),
|
|||||||
tid: tid
|
tid: tid
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
ThreadTools.unlock = function(tid, uid, callback) {
|
ThreadTools.unlock = function(tid, uid, callback) {
|
||||||
topics.setTopicField(tid, 'locked', 0);
|
topics.setTopicField(tid, 'locked', 0);
|
||||||
|
|||||||
@@ -1154,6 +1154,16 @@ var async = require('async'),
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Topics.updateTopicCount = function(callback) {
|
||||||
|
db.sortedSetCard('topics:recent', function(err, count) {
|
||||||
|
if(err) {
|
||||||
|
return callback(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
db.setObjectField('global', count, callback);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
Topics.delete = function(tid, callback) {
|
Topics.delete = function(tid, callback) {
|
||||||
async.parallel([
|
async.parallel([
|
||||||
function(next) {
|
function(next) {
|
||||||
@@ -1176,7 +1186,13 @@ var async = require('async'),
|
|||||||
db.incrObjectFieldBy('category:' + cid, 'topic_count', -1, next);
|
db.incrObjectFieldBy('category:' + cid, 'topic_count', -1, next);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
], callback);
|
], function(err) {
|
||||||
|
if (err) {
|
||||||
|
return callback(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
Topics.updateTopicCount(callback);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Topics.restore = function(tid, callback) {
|
Topics.restore = function(tid, callback) {
|
||||||
@@ -1206,7 +1222,13 @@ var async = require('async'),
|
|||||||
db.incrObjectFieldBy('category:' + cid, 'topic_count', 1, next);
|
db.incrObjectFieldBy('category:' + cid, 'topic_count', 1, next);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
], callback);
|
], function(err) {
|
||||||
|
if (err) {
|
||||||
|
return callback(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
Topics.updateTopicCount(callback);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}(exports));
|
}(exports));
|
||||||
|
|||||||
Reference in New Issue
Block a user