summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--api/tests/routes.test.ts2
-rw-r--r--util/src/entities/User.ts17
2 files changed, 11 insertions, 8 deletions
diff --git a/api/tests/routes.test.ts b/api/tests/routes.test.ts
index 2c265ee3..35d74a94 100644
--- a/api/tests/routes.test.ts
+++ b/api/tests/routes.test.ts
@@ -56,9 +56,7 @@ beforeAll(async (done) => {
 		const response = await request("/auth/register", {
 			body: {
 				fingerprint: "805826570869932034.wR8vi8lGlFBJerErO9LG5NViJFw",
-				email: "test@example.com",
 				username: "tester",
-				password: "wtp9gep9gw",
 				invite: null,
 				consent: true,
 				date_of_birth: "2000-01-01",
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,