mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-05-19 21:48:23 -05:00
Usersearch: Exclude global banned users
This commit is contained in:
parent
e08e1a9cf0
commit
ff13a8d8a3
|
|
@ -22,6 +22,7 @@ function searchUsernames(target: string, page = false) {
|
|||
};
|
||||
for (const curUser of Users.users.values()) {
|
||||
if (!curUser.id.includes(target) || curUser.id.startsWith('guest')) continue;
|
||||
if (Punishments.isGlobalBanned(curUser)) continue;
|
||||
if (curUser.connected) {
|
||||
results.online.push(`${!page ? ONLINE_SYMBOL : ''} ${curUser.name}`);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1800,6 +1800,13 @@ export const Punishments = new class {
|
|||
if (room.parent) return Punishments.isRoomBanned(user, room.parent.roomid);
|
||||
}
|
||||
|
||||
isGlobalBanned(user: User): Punishment | undefined {
|
||||
if (!user) throw new Error(`Trying to check if a non-existent user is global banned.`);
|
||||
|
||||
let punishment = Punishments.userids.getByType(user.id, "BAN") || Punishments.userids.getByType(user.id, "FORCEBAN");
|
||||
if (punishment) return punishment;
|
||||
}
|
||||
|
||||
isBlacklistedSharedIp(ip: string) {
|
||||
const num = IPTools.ipToNumber(ip);
|
||||
if (!num) throw new Error(`Invalid IP address: '${ip}'`);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user