fixes removePostFromTopic

remove the pid from the votes set too
v1.18.x
barisusakli 11 years ago
parent bf04749f5e
commit b7f71ca0b4

@ -15,15 +15,15 @@ var async = require('async'),
module.exports = function(Topics) {
Topics.createTopicFromPosts = function(uid, title, pids, callback) {
if(title) {
if (title) {
title = title.trim();
}
if(!title) {
if (!title) {
return callback(new Error('[[error:invalid-title]]'));
}
if(!pids || !pids.length) {
if (!pids || !pids.length) {
return callback(new Error('[[error:invalid-pid]]'));
}
@ -39,12 +39,12 @@ module.exports = function(Topics) {
}
}, function(err, results) {
Topics.create({uid: results.postData.uid, title: title, cid: results.cid}, function(err, tid) {
if(err) {
if (err) {
return callback(err);
}
async.eachSeries(pids, move, function(err) {
if(err) {
if (err) {
return callback(err);
}

@ -131,7 +131,14 @@ module.exports = function(Topics) {
};
Topics.removePostFromTopic = function(tid, pid, callback) {
db.sortedSetRemove('tid:' + tid + ':posts', pid, callback);
async.parallel([
function (next) {
db.sortedSetRemove('tid:' + tid + ':posts', pid, next);
},
function (next) {
db.sortedSetRemove('tid:' + tid + ':posts:votes', pid, next);
}
], callback);
};
Topics.getPids = function(tid, callback) {

Loading…
Cancel
Save