diff options
author | TheArcaneBrony <myrainbowdash949@gmail.com> | 2022-08-12 01:46:42 +0200 |
---|---|---|
committer | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-12-19 17:52:44 +1100 |
commit | 20359e7b9f453f62b8f251f19aa89ec236c082da (patch) | |
tree | 6665f7a005e70fac5d95548eeab4c0a9437fd819 /src/gateway/opcodes/Identify.ts | |
parent | Add additional config (diff) | |
download | server-20359e7b9f453f62b8f251f19aa89ec236c082da.tar.xz |
Move UserSettings to own entity
Diffstat (limited to 'src/gateway/opcodes/Identify.ts')
-rw-r--r-- | src/gateway/opcodes/Identify.ts | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/gateway/opcodes/Identify.ts b/src/gateway/opcodes/Identify.ts index fc183286..5f569fee 100644 --- a/src/gateway/opcodes/Identify.ts +++ b/src/gateway/opcodes/Identify.ts @@ -18,9 +18,10 @@ import { PrivateSessionProjection, MemberPrivateProjection, PresenceUpdateEvent, + UserSettings, + IdentifySchema, DefaultUserGuildSettings, UserGuildSettings, - IdentifySchema, } from "@fosscord/util"; import { Send } from "../util/Send"; import { CLOSECODES, OPCODES } from "../util/Constants"; @@ -60,7 +61,7 @@ export async function onIdentify(this: WebSocket, data: Payload) { await Promise.all([ User.findOneOrFail({ where: { id: this.user_id }, - relations: ["relationships", "relationships.to"], + relations: ["relationships", "relationships.to", "settings"], select: [...PrivateUserProjection, "relationships"], }), ReadState.find({ where: { user_id: this.user_id } }), @@ -105,6 +106,10 @@ export async function onIdentify(this: WebSocket, data: Payload) { ]); if (!user) return this.close(CLOSECODES.Authentication_failed); + if (!user.settings) { + user.settings = new UserSettings(); + await user.settings.save(); + } if (!identify.intents) identify.intents = BigInt("0x6ffffffff"); this.intents = new Intents(identify.intents); |