summary refs log tree commit diff
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-01-11 16:32:16 +1100
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-01-11 16:32:16 +1100
commitba52570b44498102b47f68c0cdff580adba5f1e3 (patch)
tree4a6c65cc479e03f408c80efc567fbbc76986b2ec
parenthttps://discord.com/channels/806142446094385153/898197424340860928/1062404340... (diff)
downloadserver-ba52570b44498102b47f68c0cdff580adba5f1e3.tar.xz
If defaults_user_premium is false, don't give a user `premium_since: new Date`
-rw-r--r--src/util/entities/User.ts17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/util/entities/User.ts b/src/util/entities/User.ts
index 34b7ea0e..36b38ece 100644
--- a/src/util/entities/User.ts
+++ b/src/util/entities/User.ts
@@ -101,10 +101,10 @@ export class User extends BaseClass {
 	mobile: boolean = false; // if the user has mobile app installed
 
 	@Column()
-	premium: boolean = false; // if user bought individual premium
+	premium: boolean = Config.get().defaults.user.premium; // if user bought individual premium
 
 	@Column()
-	premium_type: number = 0; // individual premium level
+	premium_type: number = Config.get().defaults.user.premiumType; // individual premium level
 
 	@Column()
 	bot: boolean = false; // if user is bot
@@ -131,10 +131,10 @@ export class User extends BaseClass {
 	created_at: Date = new Date(); // registration date
 
 	@Column({ nullable: true })
-	premium_since: Date = new Date(); // premium date
+	premium_since: Date; // premium date
 
 	@Column({ select: false })
-	verified: boolean = true; // email is verified
+	verified: boolean = Config.get().defaults.user.verified; // email is verified
 
 	@Column()
 	disabled: boolean = false; // if the account is disabled
@@ -158,7 +158,7 @@ export class User extends BaseClass {
 	premium_usage_flags: number = 0;
 
 	@Column({ type: "bigint" })
-	rights: string; // Rights
+	rights: string = Config.get().register.defaultRights;
 
 	@OneToMany(() => Session, (session: Session) => session.user)
 	sessions: Session[];
@@ -350,15 +350,14 @@ export class User extends BaseClass {
 			discriminator,
 			id: id || Snowflake.generate(),
 			email: email,
-			rights: Config.get().register.defaultRights,
 			data: {
 				hash: password,
 				valid_tokens_since: new Date(),
 			},
 			extended_settings: "{}",
-			premium_type: Config.get().defaults.user.premiumType,
-			premium: Config.get().defaults.user.premium,
-			verified: Config.get().defaults.user.verified,
+			premium_since: Config.get().defaults.user.premium
+				? new Date()
+				: undefined,
 			settings: settings,
 		});