🐛 fix client locale

This commit is contained in:
Flam3rboy
2021-10-05 19:37:35 +02:00
parent b9391bfac1
commit 9b34eba268
+2 -1
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 });