From 84a69a8a6884ebd4975167f993d8d2614d038ee5 Mon Sep 17 00:00:00 2001 From: Puyodead1 Date: Fri, 19 May 2023 15:14:40 -0400 Subject: rename pomeloEnabled to uniqueUsernames --- src/util/config/types/GeneralConfiguration.ts | 2 +- src/util/entities/User.ts | 14 +++++++------- src/util/schemas/RelationshipPostSchema.ts | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/util') diff --git a/src/util/config/types/GeneralConfiguration.ts b/src/util/config/types/GeneralConfiguration.ts index df3dfbcd..b5c8b272 100644 --- a/src/util/config/types/GeneralConfiguration.ts +++ b/src/util/config/types/GeneralConfiguration.ts @@ -29,5 +29,5 @@ export class GeneralConfiguration { image: string | null = null; instanceId: string = Snowflake.generate(); autoCreateBotUsers: boolean = false; - pomeloEnabled: boolean = false; + uniqueUsernames: boolean = false; } diff --git a/src/util/entities/User.ts b/src/util/entities/User.ts index c1a05e51..fea8ad49 100644 --- a/src/util/entities/User.ts +++ b/src/util/entities/User.ts @@ -92,10 +92,10 @@ export class User extends BaseClass { username: string; // username max length 32, min 2 (should be configurable) @Column({ nullable: true }) - global_name?: string; // puyo: pomelo + global_name?: string; // puyo: uniqueUsernames @Column() - discriminator: string; // opaque string: 4 digits on discord.com, 0 for pomelo + discriminator: string; // opaque string: 4 digits on discord.com, 0 for uniqueUsernames @Column({ nullable: true }) avatar?: string; // hash of the user avatar @@ -328,10 +328,10 @@ export class User extends BaseClass { } public get tag(): string { - const { pomeloEnabled } = Config.get().general; + const { uniqueUsernames } = Config.get().general; - // if pomelo is enabled, global_name should be set - return pomeloEnabled + // if uniqueUsernames is enabled, global_name should be set + return uniqueUsernames ? (this.global_name as string) : `${this.username}#${this.discriminator}`; } @@ -350,13 +350,13 @@ export class User extends BaseClass { id?: string; req?: Request; }) { - const { pomeloEnabled } = Config.get().general; + const { uniqueUsernames } = Config.get().general; // trim special uf8 control characters -> Backspace, Newline, ... username = trimSpecial(username); let discriminator: string | undefined; - if (pomeloEnabled) discriminator = "0"; + if (uniqueUsernames) discriminator = "0"; else { discriminator = await User.generateDiscriminator(username); if (!discriminator) { diff --git a/src/util/schemas/RelationshipPostSchema.ts b/src/util/schemas/RelationshipPostSchema.ts index f0a5fc32..8b9f8611 100644 --- a/src/util/schemas/RelationshipPostSchema.ts +++ b/src/util/schemas/RelationshipPostSchema.ts @@ -16,7 +16,7 @@ along with this program. If not, see . */ -// TODO: pomelo? +// TODO: uniqueUsernames? export interface RelationshipPostSchema { discriminator: string; username: string; -- cgit 1.5.1