Extend the pretense of non-existence of self-bans to API view route too

This commit is contained in:
Erkin Alp Güney 2022-02-02 23:27:54 +03:00 committed by GitHub
parent 8b641d099a
commit 3e0f568ba4

View File

@ -27,6 +27,8 @@ router.get("/", route({ permission: "BAN_MEMBERS" }), async (req: Request, res:
let bans = await Ban.find({ guild_id: guild_id }); let bans = await Ban.find({ guild_id: guild_id });
/* Filter secret from database registry.*/ /* Filter secret from database registry.*/
if (banned_user.user_id === banned_user.executor_id) throw DiscordApiErrors.UNKNOWN_BAN;
// hide self-bans from view to prevent victim chasing
bans.forEach((registry: BanRegistrySchema) => { bans.forEach((registry: BanRegistrySchema) => {
delete registry.ip; delete registry.ip;