fix: #8681 change owner modal's search should check if user is banned

This commit is contained in:
psychobunny
2020-09-25 14:47:22 -04:00
parent 611f3c6155
commit b6f2f0e5d0
3 changed files with 7 additions and 2 deletions

View File

@@ -24,6 +24,7 @@ module.exports = function (SocketUser) {
sortBy: data.sortBy,
onlineOnly: data.onlineOnly,
bannedOnly: data.bannedOnly,
notBanned: data.notBanned,
flaggedOnly: data.flaggedOnly,
paginate: data.paginate,
uid: socket.uid,

View File

@@ -78,7 +78,7 @@ module.exports = function (User) {
if (data.onlineOnly) {
fields.push('status', 'lastonline');
}
if (data.bannedOnly) {
if (data.bannedOnly || data.notBanned) {
fields.push('banned');
}
if (data.flaggedOnly) {
@@ -104,6 +104,10 @@ module.exports = function (User) {
userData = userData.filter(user => user.banned);
}
if (data.notBanned) {
userData = userData.filter(user => !user.banned);
}
if (data.flaggedOnly) {
userData = userData.filter(user => parseInt(user.flags, 10) > 0);
}