summary refs log tree commit diff
path: root/api/src/routes/users/@me
diff options
context:
space:
mode:
authoruurgothat <cckhmck@gmail.com>2021-10-17 21:49:46 +0300
committeruurgothat <cckhmck@gmail.com>2021-10-17 21:49:46 +0300
commitdb3d6e116a3b49669103abdf5f2d156b2c78c3c4 (patch)
tree1a1a5f4d03ca5d0b94ca5f47456e7cd536ba21e7 /api/src/routes/users/@me
parentMerge branch 'master' of https://github.com/fosscord/fosscord-server (diff)
parentUpdate README.md (diff)
downloadserver-ts-db3d6e116a3b49669103abdf5f2d156b2c78c3c4.tar.xz
Merge branch 'master' of https://github.com/fosscord/fosscord-server
Diffstat (limited to 'api/src/routes/users/@me')
-rw-r--r--api/src/routes/users/@me/settings.ts5
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); });