mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-11 08:25:46 +01:00
on user delete remove from ip sorted set, fix search by ip
This commit is contained in:
@@ -79,11 +79,14 @@ module.exports = function(User) {
|
|||||||
'uid:' + uid + ':favourites', 'uid:' + uid + ':followed_tids', 'user:' + uid + ':settings',
|
'uid:' + uid + ':favourites', 'uid:' + uid + ':followed_tids', 'user:' + uid + ':settings',
|
||||||
'uid:' + uid + ':topics', 'uid:' + uid + ':posts',
|
'uid:' + uid + ':topics', 'uid:' + uid + ':posts',
|
||||||
'uid:' + uid + ':chats', 'uid:' + uid + ':chats:unread',
|
'uid:' + uid + ':chats', 'uid:' + uid + ':chats:unread',
|
||||||
'uid:' + uid + ':ip', 'uid:' + uid + ':upvote', 'uid:' + uid + ':downvote',
|
'uid:' + uid + ':upvote', 'uid:' + uid + ':downvote',
|
||||||
'uid:' + uid + ':ignored:cids'
|
'uid:' + uid + ':ignored:cids'
|
||||||
];
|
];
|
||||||
db.deleteAll(keys, next);
|
db.deleteAll(keys, next);
|
||||||
},
|
},
|
||||||
|
function(next) {
|
||||||
|
deleteUserIps(uids, next);
|
||||||
|
},
|
||||||
function(next) {
|
function(next) {
|
||||||
deleteUserFromFollowers(uid, next);
|
deleteUserFromFollowers(uid, next);
|
||||||
},
|
},
|
||||||
@@ -110,6 +113,23 @@ 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);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function deleteUserFromFollowers(uid, callback) {
|
function deleteUserFromFollowers(uid, callback) {
|
||||||
db.getSetMembers('followers:' + uid, function(err, uids) {
|
db.getSetMembers('followers:' + uid, function(err, uids) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ module.exports = function(User) {
|
|||||||
return callback(null, {timing: 0, users: [], matchCount: 0, pages: []});
|
return callback(null, {timing: 0, users: [], matchCount: 0, pages: []});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchBy === 'ip') {
|
if (searchBy.indexOf('ip') !== -1) {
|
||||||
return searchByIP(query, callback);
|
return searchByIP(query, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user