🐛 user settings
This commit is contained in:
parent
64f4fe0591
commit
a43ee81b4a
@ -10,8 +10,9 @@ router.patch("/", route({ body: "UserSettingsSchema" }), async (req: Request, re
|
|||||||
const body = req.body as UserSettings;
|
const body = req.body as UserSettings;
|
||||||
if (body.locale === "en") body.locale = "en-US"; // fix discord client crash on unkown locale
|
if (body.locale === "en") body.locale = "en-US"; // fix discord client crash on unkown locale
|
||||||
|
|
||||||
// only users can update user settings
|
const user = await User.findOneOrFail({ id: req.user_id, bot: false });
|
||||||
await User.update({ id: req.user_id, bot: false }, { settings: body });
|
user.settings = { ...user.settings, ...body };
|
||||||
|
await user.save();
|
||||||
|
|
||||||
res.sendStatus(204);
|
res.sendStatus(204);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user