diff options
author | Erkin Alp Güney <erkinalp9035@gmail.com> | 2022-02-04 23:36:42 +0300 |
---|---|---|
committer | Erkin Alp Güney <erkinalp9035@gmail.com> | 2022-02-04 23:36:42 +0300 |
commit | 6a67f50c39a87614c66ffb74705a7ca746815979 (patch) | |
tree | 9f7be5052d67909604ad08d907f614b298fa597d | |
parent | ban moderator schema actually change (diff) | |
download | server-6a67f50c39a87614c66ffb74705a7ca746815979.tar.xz |
pretend self-bans don't exist in the views too
-rw-r--r-- | api/src/routes/guilds/#guild_id/bans.ts | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/api/src/routes/guilds/#guild_id/bans.ts b/api/src/routes/guilds/#guild_id/bans.ts index 4c5ba48f..7ccf34d7 100644 --- a/api/src/routes/guilds/#guild_id/bans.ts +++ b/api/src/routes/guilds/#guild_id/bans.ts @@ -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); }); |