Fix not assigning new changes to input fields in users/@me

This commit is contained in:
Madeline 2022-04-23 01:48:41 +10:00
parent 2846e970b4
commit 6e0040a8ca

View File

@ -34,7 +34,6 @@ router.patch("/", route({ body: "UserModifySchema" }), async (req: Request, res:
if (body.banner) body.banner = await handleFile(`/banners/${req.user_id}`, body.banner as string);
const user = await User.findOneOrFail({ where: { id: req.user_id }, select: [...PrivateUserProjection, "data"] });
user.assign(body);
if (body.password) {
if (user.data?.hash) {
@ -65,6 +64,7 @@ router.patch("/", route({ body: "UserModifySchema" }), async (req: Request, res:
}
}
user.assign(body);
await user.save();
// @ts-ignore