summary refs log tree commit diff
path: root/util
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-10-17 00:41:24 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-10-17 00:41:24 +0200
commit95f5fb3b9326110b0e6f1064d53eed0b4cd1fb15 (patch)
tree780544846158d09de7bd83cef2fad01f050c08c9 /util
parent:art: clean up instances on start (diff)
downloadserver-95f5fb3b9326110b0e6f1064d53eed0b4cd1fb15.tar.xz
:art: reformatted
Diffstat (limited to 'util')
-rw-r--r--util/src/entities/User.ts17
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,