Try to fix duplicate user settings

This commit is contained in:
Rory& 2025-10-11 05:32:32 +02:00
parent 93294e4963
commit 0b2e8981c0
4 changed files with 2 additions and 1 deletions

Binary file not shown.

Binary file not shown.

View File

@ -358,6 +358,7 @@ export async function onIdentify(this: WebSocket, data: Payload) {
// so for instances that migrated, users may not have a `user_settings` row.
let createUserSettingsTime: ElapsedTime | undefined = undefined;
if (!user.settings) {
console.warn("[WARN] Creating new user settings!")
user.settings = new UserSettings();
await user.settings.save();
createUserSettingsTime = taskSw.getElapsedAndReset();

View File

@ -58,7 +58,7 @@ export enum PrivateUserEnum {
purchased_flags,
premium_usage_flags,
disabled,
// settings, // now a relation
settings,
// locale
}
export type PrivateUserKeys = keyof typeof PrivateUserEnum | PublicUserKeys;