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

v1.18.x
psychobunny 4 years ago
parent 611f3c6155
commit b6f2f0e5d0

@ -37,7 +37,7 @@ define('forum/topic/change-owner', [
changeOwner();
});
autocomplete.user(modal.find('#username'), function (ev, ui) {
autocomplete.user(modal.find('#username'), { notBanned: true }, function (ev, ui) {
toUid = ui.item.user.uid;
checkButtonEnable();
});

@ -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,

@ -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);
}

Loading…
Cancel
Save