This commit is contained in:
barisusakli
2014-11-07 17:46:03 -05:00
parent b60ed95d20
commit 642136f6f8
3 changed files with 11 additions and 7 deletions

View File

@@ -32,8 +32,8 @@ var winston = require('winston'),
};
function toggleDelete(tid, uid, isDelete, callback) {
topics.getTopicFields(tid, ['cid', 'deleted'], function(err, topicData) {
if(err) {
topics.getTopicFields(tid, ['tid', 'cid', 'deleted', 'title'], function(err, topicData) {
if (err) {
return callback(err);
}
@@ -49,13 +49,16 @@ var winston = require('winston'),
isDelete: isDelete
});
}
if(err) {
if (err) {
return callback(err);
}
ThreadTools[isDelete ? 'lock' : 'unlock'](tid);
plugins.fireHook(isDelete ? 'action:topic.delete' : 'action:topic.restore', tid);
if (isDelete) {
plugins.fireHook('action:topic.delete', tid);
} else {
plugins.fireHook('action:topic.restore', topicData);
}
events[isDelete ? 'logTopicDelete' : 'logTopicRestore'](uid, tid);