1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-11 05:02:37 +01:00

🐛 fix client locale

This commit is contained in:
Flam3rboy 2021-10-05 19:37:35 +02:00
parent 1bc56e5131
commit 89ff4bc685

View File

@ -4,10 +4,11 @@ import { route } from "@fosscord/api";
const router = Router();
export interface UserSettingsSchema extends UserSettings {}
export interface UserSettingsSchema extends Partial<UserSettings> {}
router.patch("/", route({ body: "UserSettingsSchema" }), async (req: Request, res: Response) => {
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 });