diff options
author | Nobody <17956512+n0bodysec@users.noreply.github.com> | 2022-03-08 12:15:38 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-08 12:15:38 -0300 |
commit | c1b22dc541499c667b50743d1ffa3c0d968dad4b (patch) | |
tree | 7a071e4bde02eb5808c4ac7917d67677a844ebe2 /api | |
parent | fix(api): working ban list (diff) | |
parent | Temporary notes fix (diff) | |
download | server-c1b22dc541499c667b50743d1ffa3c0d968dad4b.tar.xz |
Merge branch 'master' into fix/ban-list
Diffstat (limited to 'api')
-rw-r--r-- | api/assets/openapi.json | 4 | ||||
-rw-r--r-- | api/assets/schemas.json | 2 | ||||
-rw-r--r-- | api/src/routes/guilds/#guild_id/members/#member_id/index.ts | 6 | ||||
-rw-r--r-- | api/src/routes/users/@me/notes.ts | 6 |
4 files changed, 12 insertions, 6 deletions
diff --git a/api/assets/openapi.json b/api/assets/openapi.json index 1af0600d..03550323 100644 --- a/api/assets/openapi.json +++ b/api/assets/openapi.json @@ -3119,7 +3119,7 @@ "type": "boolean" }, "status": { - "enum": ["dnd", "idle", "offline", "online"], + "enum": ["dnd", "idle", "offline", "online", "invisible"], "type": "string" }, "stream_notifications_enabled": { @@ -5677,7 +5677,7 @@ "type": "boolean" }, "status": { - "enum": ["dnd", "idle", "offline", "online"], + "enum": ["dnd", "idle", "offline", "online", "invisible"], "type": "string" }, "stream_notifications_enabled": { diff --git a/api/assets/schemas.json b/api/assets/schemas.json index 4ffa44b8..d531df21 100644 --- a/api/assets/schemas.json +++ b/api/assets/schemas.json @@ -7897,7 +7897,7 @@ "type": "boolean" }, "status": { - "enum": ["dnd", "idle", "offline", "online"], + "enum": ["dnd", "idle", "offline", "online", "invisible"], "type": "string" }, "stream_notifications_enabled": { diff --git a/api/src/routes/guilds/#guild_id/members/#member_id/index.ts b/api/src/routes/guilds/#guild_id/members/#member_id/index.ts index 24c74af7..34836292 100644 --- a/api/src/routes/guilds/#guild_id/members/#member_id/index.ts +++ b/api/src/routes/guilds/#guild_id/members/#member_id/index.ts @@ -25,13 +25,19 @@ router.patch("/", route({ body: "MemberChangeSchema" }), async (req: Request, re const member = await Member.findOneOrFail({ where: { id: member_id, guild_id }, relations: ["roles", "user"] }); const permission = await getPermission(req.user_id, guild_id); + const everyone = await Role.findOneOrFail({ guild_id: guild_id, name: "@everyone", position: 0 }); if (body.roles) { permission.hasThrow("MANAGE_ROLES"); + + if (body.roles.indexOf(everyone.id) === -1) body.roles.push(everyone.id); member.roles = body.roles.map((x) => new Role({ id: x })); // foreign key constraint will fail if role doesn't exist } await member.save(); + + member.roles = member.roles.filter((x) => x.id !== everyone.id); + // do not use promise.all as we have to first write to db before emitting the event to catch errors await emitEvent({ event: "GUILD_MEMBER_UPDATE", diff --git a/api/src/routes/users/@me/notes.ts b/api/src/routes/users/@me/notes.ts index 2ef27bc0..96067bf5 100644 --- a/api/src/routes/users/@me/notes.ts +++ b/api/src/routes/users/@me/notes.ts @@ -6,9 +6,9 @@ const router: Router = Router(); router.put("/:id", route({}), async (req: Request, res: Response) => { //TODO res.json({ - message: "400: Bad Request", - code: 0 - }).status(400); + message: "Unknown User", + code: 10013 + }).status(404); }); export default router; |