diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-10-17 00:41:24 +0200 |
---|---|---|
committer | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-10-17 00:41:24 +0200 |
commit | 5249e923a0614e83ac5a7ffb1885308b3f4a936e (patch) | |
tree | 035980c65bcbea455baa157656e8b067bf284833 /util/src/entities | |
parent | :art: clean up instances on start (diff) | |
download | server-5249e923a0614e83ac5a7ffb1885308b3f4a936e.tar.xz |
:art: reformatted
Diffstat (limited to 'util/src/entities')
-rw-r--r-- | util/src/entities/User.ts | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/util/src/entities/User.ts b/util/src/entities/User.ts index 04f1e9cb..bc852616 100644 --- a/util/src/entities/User.ts +++ b/util/src/entities/User.ts @@ -4,7 +4,7 @@ import { BitField } from "../util/BitField"; import { Relationship } from "./Relationship"; import { ConnectedAccount } from "./ConnectedAccount"; import { Config, FieldErrors, Snowflake, trimSpecial } from ".."; -import { Member } from "."; +import { Member, Session } from "."; export enum PublicUserEnum { username, @@ -131,6 +131,9 @@ export class User extends BaseClass { @Column() rights: string; // Rights + @OneToMany(() => Session, (session: Session) => session.user) + sessions: Session[]; + @JoinColumn({ name: "relationship_ids" }) @OneToMany(() => Relationship, (relationship: Relationship) => relationship.from, { cascade: true, @@ -250,11 +253,13 @@ export class User extends BaseClass { await user.save(); - if (Config.get().guild.autoJoin.enabled) { - for (const guild of Config.get().guild.autoJoin.guilds || []) { - await Member.addToGuild(user.id, guild); + setImmediate(async () => { + if (Config.get().guild.autoJoin.enabled) { + for (const guild of Config.get().guild.autoJoin.guilds || []) { + await Member.addToGuild(user.id, guild).catch((e) => {}); + } } - } + }); return user; } @@ -293,7 +298,7 @@ export const defaultSettings: UserSettings = { render_reactions: true, restricted_guilds: [], show_current_game: true, - status: "offline", + status: "online", stream_notifications_enabled: true, theme: "dark", timezone_offset: 0, |