summary refs log tree commit diff
diff options
context:
space:
mode:
authorPuyodead1 <puyodead@protonmail.com>2023-05-05 11:24:17 -0400
committerRory& <root@rory.gay>2026-01-21 07:10:10 +0100
commit3341c9cf9809371b70e33706d89b7a10a7f4d793 (patch)
treed2723b947cbe2be49d5f438bb74c005989a10942
parentinitial pomelo implementation (diff)
downloadserver-ts-3341c9cf9809371b70e33706d89b7a10a7f4d793.tar.xz
lint
-rw-r--r--src/util/entities/User.ts18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/util/entities/User.ts b/src/util/entities/User.ts

index e527598f..5c98941a 100644 --- a/src/util/entities/User.ts +++ b/src/util/entities/User.ts
@@ -55,10 +55,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() @@ -271,10 +271,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({ @@ -292,14 +294,14 @@ export class User extends BaseClass { id?: string; req?: Request; bot?: boolean; - }) { - 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) { @@ -307,7 +309,7 @@ export class User extends BaseClass { throw FieldErrors({ username: { code: "USERNAME_TOO_MANY_USERS", - message: req?.t("auth:register.USERNAME_TOO_MANY_USERS") || "", + message: req?.t("auth:register.USERNAME_TOO_MANY_USERS") || "", }, }); }