1
0
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:
Madeline 2022-09-25 00:04:21 +10:00
parent eb0c05f01f
commit 5cd152e3a9
No known key found for this signature in database
GPG Key ID: 80D25DA3BCB24281

View File

@ -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();