fix topic move

v1.18.x
barisusakli 11 years ago
parent 10b30e303b
commit 84d0e64361

@ -43,7 +43,7 @@ define('forum/topic/move', function() {
renderCategories(categories);
modal.find('.category-list').on('click', 'li[data-cid]', function(e) {
modal.on('click', '.category-list li[data-cid]', function(e) {
selectCategory($(this));
});

@ -13,14 +13,18 @@ module.exports = function(db, module) {
value: value
};
db.collection('objects').update({_key: key, value: value}, {$set: data}, {upsert:true, w: 1}, callback);
db.collection('objects').update({_key: key, value: value}, {$set: data}, {upsert:true, w: 1}, function(err) {
callback(err);
});
};
module.sortedSetRemove = function(key, value, callback) {
callback = callback || helpers.noop;
value = helpers.valueToString(value);
db.collection('objects').remove({_key: key, value: value}, callback);
db.collection('objects').remove({_key: key, value: value}, function(err) {
callback(err);
});
};
module.sortedSetsRemove = function(keys, value, callback) {

@ -3,11 +3,16 @@
module.exports = function(redisClient, module) {
module.sortedSetAdd = function(key, score, value, callback) {
callback = callback || function() {};
redisClient.zadd(key, score, value, callback);
redisClient.zadd(key, score, value, function(err) {
callback(err);
});
};
module.sortedSetRemove = function(key, value, callback) {
redisClient.zrem(key, value, callback);
callback = callback || function() {};
redisClient.zrem(key, value, function(err) {
callback(err);
});
};
module.sortedSetsRemove = function(keys, value, callback) {

@ -85,7 +85,7 @@ Sockets.init = function(server) {
if (uid) {
db.sortedSetAdd('users:online', Date.now(), uid, function(err, data) {
db.sortedSetAdd('users:online', Date.now(), uid, function(err) {
socket.join('uid_' + uid);
async.parallel({

@ -189,12 +189,12 @@ var winston = require('winston'),
topic = topicData;
db.sortedSetRemove('categories:' + topicData.cid + ':tid', tid, next);
},
function(result, next) {
function(next) {
var timestamp = parseInt(topic.pinned, 10) ? Math.pow(2, 53) : topic.lastposttime;
db.sortedSetAdd('categories:' + cid + ':tid', timestamp, tid, next);
}
], function(err, result) {
if(err) {
], function(err) {
if (err) {
return callback(err);
}
var oldCid = topic.cid;

@ -271,14 +271,14 @@ describe('Test database', function() {
it('should not throw err', function(done) {
function sortedSetAdd(callback) {
db.sortedSetAdd('sortedSet3', 12, 5, function(err, data) {
callback(err, {'sortedSetAdd': data});
db.sortedSetAdd('sortedSet3', 12, 5, function(err) {
callback(err);
});
}
function sortedSetRemove(callback) {
db.sortedSetRemove('sortedSet3', 12, function(err, data) {
callback(err, {'sortedSetRemove': data});
callback(err);
});
}

Loading…
Cancel
Save