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 | e73d1954b8badaaa412adf5ac89800f9687d483c (patch) | |
tree | e11a8f1c17594c74c38b60c604f52247e9842d9d | |
parent | ban moderator schema actually change (diff) | |
download | server-e73d1954b8badaaa412adf5ac89800f9687d483c.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); }); |