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) {
|
||||
db.getSortedSetRange('uid:' + uid + ':ip', 0, -1, function(err, ips) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
async.each(ips, function(ip, next) {
|
||||
db.sortedSetRemove('ip:' + ip + ':uid', uid, next);
|
||||
}, function(err) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
db.delete('uid:' + uid + ':ip', callback);
|
||||
});
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
db.getSortedSetRange('uid:' + uid + ':ip', 0, -1, next);
|
||||
},
|
||||
function (ips, next) {
|
||||
var keys = ips.map(function(ip) {
|
||||
return 'ip:' + ip + ':uid';
|
||||
});
|
||||
db.sortedSetsRemove(keys, uid, next);
|
||||
},
|
||||
function (next) {
|
||||
db.delete('uid:' + uid + ':ip', next);
|
||||
}
|
||||
], callback);
|
||||
}
|
||||
|
||||
function deleteUserFromFollowers(uid, callback) {
|
||||
|
||||
Reference in New Issue
Block a user