Fix not assigning new changes to input fields in users/@me
This commit is contained in:
parent
2846e970b4
commit
6e0040a8ca
@ -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);
|
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"] });
|
const user = await User.findOneOrFail({ where: { id: req.user_id }, select: [...PrivateUserProjection, "data"] });
|
||||||
user.assign(body);
|
|
||||||
|
|
||||||
if (body.password) {
|
if (body.password) {
|
||||||
if (user.data?.hash) {
|
if (user.data?.hash) {
|
||||||
@ -65,6 +64,7 @@ router.patch("/", route({ body: "UserModifySchema" }), async (req: Request, res:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
user.assign(body);
|
||||||
await user.save();
|
await user.save();
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
Loading…
x
Reference in New Issue
Block a user