1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-25 11:43:07 +01:00

If defaults_user_premium is false, don't give a user premium_since: new Date

This commit is contained in:
Madeline 2023-01-11 16:32:16 +11:00
parent 7fc3634211
commit b0e2b450af

View File

@ -101,10 +101,10 @@ export class User extends BaseClass {
mobile: boolean = false; // if the user has mobile app installed mobile: boolean = false; // if the user has mobile app installed
@Column() @Column()
premium: boolean = false; // if user bought individual premium premium: boolean = Config.get().defaults.user.premium; // if user bought individual premium
@Column() @Column()
premium_type: number = 0; // individual premium level premium_type: number = Config.get().defaults.user.premiumType; // individual premium level
@Column() @Column()
bot: boolean = false; // if user is bot bot: boolean = false; // if user is bot
@ -131,10 +131,10 @@ export class User extends BaseClass {
created_at: Date = new Date(); // registration date created_at: Date = new Date(); // registration date
@Column({ nullable: true }) @Column({ nullable: true })
premium_since: Date = new Date(); // premium date premium_since: Date; // premium date
@Column({ select: false }) @Column({ select: false })
verified: boolean = true; // email is verified verified: boolean = Config.get().defaults.user.verified; // email is verified
@Column() @Column()
disabled: boolean = false; // if the account is disabled disabled: boolean = false; // if the account is disabled
@ -158,7 +158,7 @@ export class User extends BaseClass {
premium_usage_flags: number = 0; premium_usage_flags: number = 0;
@Column({ type: "bigint" }) @Column({ type: "bigint" })
rights: string; // Rights rights: string = Config.get().register.defaultRights;
@OneToMany(() => Session, (session: Session) => session.user) @OneToMany(() => Session, (session: Session) => session.user)
sessions: Session[]; sessions: Session[];
@ -350,15 +350,14 @@ export class User extends BaseClass {
discriminator, discriminator,
id: id || Snowflake.generate(), id: id || Snowflake.generate(),
email: email, email: email,
rights: Config.get().register.defaultRights,
data: { data: {
hash: password, hash: password,
valid_tokens_since: new Date(), valid_tokens_since: new Date(),
}, },
extended_settings: "{}", extended_settings: "{}",
premium_type: Config.get().defaults.user.premiumType, premium_since: Config.get().defaults.user.premium
premium: Config.get().defaults.user.premium, ? new Date()
verified: Config.get().defaults.user.verified, : undefined,
settings: settings, settings: settings,
}); });