more error checks in thread move

v1.18.x
Baris Soner Usakli 11 years ago
parent 810095d287
commit bd0b5f4cdb

@ -187,9 +187,20 @@ var winston = require('winston'),
ThreadTools.move = function(tid, cid, callback) { ThreadTools.move = function(tid, cid, callback) {
topics.getTopicFields(tid, ['cid', 'lastposttime'], function(err, topicData) { topics.getTopicFields(tid, ['cid', 'lastposttime'], function(err, topicData) {
if(err) {
return callback(err);
}
var oldCid = topicData.cid; var oldCid = topicData.cid;
if(!oldCid) {
return callback(new Error('invalid-topic'));
}
db.sortedSetRemove('categories:' + oldCid + ':tid', tid, function(err, result) { db.sortedSetRemove('categories:' + oldCid + ':tid', tid, function(err, result) {
if(err) {
return callback(err);
}
db.sortedSetAdd('categories:' + cid + ':tid', topicData.lastposttime, tid, function(err, result) { db.sortedSetAdd('categories:' + cid + ':tid', topicData.lastposttime, tid, function(err, result) {
if(err) { if(err) {

Loading…
Cancel
Save