mirror of
https://github.com/spacebarchat/server.git
synced 2026-05-30 15:54:24 +00:00
Fix default rights sucking, fix patch /guilds/:id/members/:id not checking perm for nick
This commit is contained in:
@@ -35,7 +35,10 @@ router.patch("/", route({ body: "MemberChangeSchema" }), async (req: Request, re
|
||||
member.roles = body.roles.map((x) => new Role({ id: x })); // foreign key constraint will fail if role doesn't exist
|
||||
}
|
||||
|
||||
if (body.nick) member.nick = body.nick;
|
||||
if (body.nick) {
|
||||
permission.hasThrow(req.user_id == member.user.id ? "CHANGE_NICKNAME" : "MANAGE_NICKNAMES");
|
||||
member.nick = body.nick;
|
||||
}
|
||||
|
||||
await member.save();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user