rename pomeloEnabled to uniqueUsernames

This commit is contained in:
Puyodead1
2023-12-23 16:35:02 -05:00
committed by Puyodead1
parent 0939236cc0
commit 84a69a8a68
9 changed files with 18 additions and 18 deletions
@@ -29,5 +29,5 @@ export class GeneralConfiguration {
image: string | null = null;
instanceId: string = Snowflake.generate();
autoCreateBotUsers: boolean = false;
pomeloEnabled: boolean = false;
uniqueUsernames: boolean = false;
}
+7 -7
View File
@@ -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) {
+1 -1
View File
@@ -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;