diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-10-17 00:41:06 +0200 |
---|---|---|
committer | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-10-17 00:41:06 +0200 |
commit | 15fbb134cf1ec01db02df1b3eeeb5b6781e6a613 (patch) | |
tree | 1036fda703b1b1ad04ce5c494aa86e144ce5f6fb /api/src | |
parent | :zap: added benchmark (diff) | |
download | server-15fbb134cf1ec01db02df1b3eeeb5b6781e6a613.tar.xz |
:bug: user settings
Diffstat (limited to 'api/src')
-rw-r--r-- | api/src/routes/users/@me/settings.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/api/src/routes/users/@me/settings.ts b/api/src/routes/users/@me/settings.ts index 4e014126..b22b72fb 100644 --- a/api/src/routes/users/@me/settings.ts +++ b/api/src/routes/users/@me/settings.ts @@ -10,8 +10,9 @@ router.patch("/", route({ body: "UserSettingsSchema" }), async (req: Request, re const body = req.body as UserSettings; if (body.locale === "en") body.locale = "en-US"; // fix discord client crash on unkown locale - // only users can update user settings - await User.update({ id: req.user_id, bot: false }, { settings: body }); + const user = await User.findOneOrFail({ id: req.user_id, bot: false }); + user.settings = { ...user.settings, ...body }; + await user.save(); res.sendStatus(204); }); |