v1.18.x
Baris Soner Usakli 11 years ago
parent f7cdc8c68c
commit 8feac114c3

@ -65,8 +65,6 @@ var winston = require('winston'),
return callback(err);
}
db.decrObjectField('global', 'topicCount');
ThreadTools.lock(tid);
Plugins.fireHook('action:topic.delete', tid);
@ -101,10 +99,10 @@ var winston = require('winston'),
return callback(err);
}
db.incrObjectField('global', 'topicCount');
ThreadTools.unlock(tid);
Plugins.fireHook('action:topic.restore', tid);
events.logTopicRestore(uid, tid);
websockets.emitTopicPostStats();
@ -113,8 +111,6 @@ var winston = require('winston'),
tid: tid
});
Plugins.fireHook('action:topic.restore', tid);
callback(null, {
tid:tid
});
@ -134,7 +130,7 @@ var winston = require('winston'),
tid: tid
});
}
}
};
ThreadTools.unlock = function(tid, uid, callback) {
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) {
async.parallel([
function(next) {
@ -1176,7 +1186,13 @@ var async = require('async'),
db.incrObjectFieldBy('category:' + cid, 'topic_count', -1, next);
});
}
], callback);
], function(err) {
if (err) {
return callback(err);
}
Topics.updateTopicCount(callback);
});
};
Topics.restore = function(tid, callback) {
@ -1206,7 +1222,13 @@ var async = require('async'),
db.incrObjectFieldBy('category:' + cid, 'topic_count', 1, next);
});
}
], callback);
], function(err) {
if (err) {
return callback(err);
}
Topics.updateTopicCount(callback);
});
});
};
}(exports));

Loading…
Cancel
Save