summary refs log tree commit diff
path: root/src/util
diff options
context:
space:
mode:
authorPuyodead1 <puyodead@proton.me>2023-05-19 15:14:40 -0400
committerPuyodead1 <puyodead@protonmail.com>2023-12-23 16:35:02 -0500
commit84a69a8a6884ebd4975167f993d8d2614d038ee5 (patch)
treef2ec5d16b1c208bb6f74c14173fdb7ffac49a951 /src/util
parentremove display_name (diff)
downloadserver-ts-84a69a8a6884ebd4975167f993d8d2614d038ee5.tar.xz
rename pomeloEnabled to uniqueUsernames
Diffstat (limited to 'src/util')
-rw-r--r--src/util/config/types/GeneralConfiguration.ts2
-rw-r--r--src/util/entities/User.ts14
-rw-r--r--src/util/schemas/RelationshipPostSchema.ts2
3 files changed, 9 insertions, 9 deletions
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 <https://www.gnu.org/licenses/>. */ -// TODO: pomelo? +// TODO: uniqueUsernames? export interface RelationshipPostSchema { discriminator: string; username: string;