mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-10 04:32:35 +01:00
Potential nick reset fix
This commit is contained in:
parent
eb0c05f01f
commit
5cd152e3a9
@ -35,9 +35,9 @@ 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) {
|
||||
if ('nick' in body) {
|
||||
permission.hasThrow(req.user_id == member.user.id ? "CHANGE_NICKNAME" : "MANAGE_NICKNAMES");
|
||||
member.nick = body.nick;
|
||||
member.nick = body.nick?.trim() || undefined;
|
||||
}
|
||||
|
||||
await member.save();
|
||||
|
Loading…
Reference in New Issue
Block a user