pretend self-bans don't exist in the views too

This commit is contained in:
Erkin Alp Güney 2022-02-04 23:36:42 +03:00
parent 2f30f5b100
commit e73d1954b8

View File

@ -35,11 +35,14 @@ router.get("/", route({ permission: "BAN_MEMBERS" }), async (req: Request, res:
let bans = await Ban.find({ guild_id: guild_id });
/* Filter secret from database registry.*/
bans.filter(ban => ban.user_id !== ban.executor_id);
// pretend self-bans don't exist to prevent victim chasing
bans.forEach((registry: BanRegistrySchema) => {
delete registry.ip;
});
return res.json(bans);
});