summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPuyodead1 <puyodead@protonmail.com>2023-05-05 11:24:17 -0400
committerPuyodead1 <puyodead@protonmail.com>2023-12-23 16:32:29 -0500
commitcfd8dc0141b2756afcb3e4270399c1000fc9bb3b (patch)
tree352165542e5def31ac6f1d040cc096d2a2ac3cec /src
parentinitial pomelo implementation (diff)
downloadserver-cfd8dc0141b2756afcb3e4270399c1000fc9bb3b.tar.xz
lint
Diffstat (limited to 'src')
-rw-r--r--src/util/entities/User.ts17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/util/entities/User.ts b/src/util/entities/User.ts

index 0620640b..f658c286 100644 --- a/src/util/entities/User.ts +++ b/src/util/entities/User.ts
@@ -92,10 +92,10 @@ export class User extends BaseClass { @Column() username: string; // username max length 32, min 2 (should be configurable) - @Column({nullable: true}) + @Column({ nullable: true }) global_name: string; // puyo: pomelo - @Column({nullable: true}) + @Column({ nullable: true }) display_name?: string; // puyo: pomelo @Column() @@ -332,10 +332,12 @@ export class User extends BaseClass { } public get handle(): string { - const {pomeloEnabled} = Config.get().general; + const { pomeloEnabled } = Config.get().general; // if pomelo is enabled, global_name should be set - return pomeloEnabled ? this.global_name as string : `${this.username}#${this.discriminator}`; + return pomeloEnabled + ? (this.global_name as string) + : `${this.username}#${this.discriminator}`; } static async register({ @@ -352,13 +354,13 @@ export class User extends BaseClass { id?: string; req?: Request; }) { - const {pomeloEnabled} = Config.get().general; + const { pomeloEnabled } = Config.get().general; // trim special uf8 control characters -> Backspace, Newline, ... username = trimSpecial(username); let discriminator: string | undefined; - if(pomeloEnabled) discriminator = "0"; + if (pomeloEnabled) discriminator = "0"; else { discriminator = await User.generateDiscriminator(username); if (!discriminator) { @@ -367,7 +369,8 @@ export class User extends BaseClass { username: { code: "USERNAME_TOO_MANY_USERS", message: - req?.t("auth:register.USERNAME_TOO_MANY_USERS") || "", + req?.t("auth:register.USERNAME_TOO_MANY_USERS") || + "", }, }); }