mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-11 16:35:47 +01:00
use sortedSetsRemove
This commit is contained in:
@@ -125,20 +125,20 @@ module.exports = function(User) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function deleteUserIps(uid, callback) {
|
function deleteUserIps(uid, callback) {
|
||||||
db.getSortedSetRange('uid:' + uid + ':ip', 0, -1, function(err, ips) {
|
async.waterfall([
|
||||||
if (err) {
|
function (next) {
|
||||||
return callback(err);
|
db.getSortedSetRange('uid:' + uid + ':ip', 0, -1, next);
|
||||||
}
|
},
|
||||||
|
function (ips, next) {
|
||||||
async.each(ips, function(ip, next) {
|
var keys = ips.map(function(ip) {
|
||||||
db.sortedSetRemove('ip:' + ip + ':uid', uid, next);
|
return 'ip:' + ip + ':uid';
|
||||||
}, function(err) {
|
|
||||||
if (err) {
|
|
||||||
return callback(err);
|
|
||||||
}
|
|
||||||
db.delete('uid:' + uid + ':ip', callback);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
db.sortedSetsRemove(keys, uid, next);
|
||||||
|
},
|
||||||
|
function (next) {
|
||||||
|
db.delete('uid:' + uid + ':ip', next);
|
||||||
|
}
|
||||||
|
], callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteUserFromFollowers(uid, callback) {
|
function deleteUserFromFollowers(uid, callback) {
|
||||||
|
|||||||
Reference in New Issue
Block a user