diff --git a/src/api/routes/channels/#channel_id/messages/index.ts b/src/api/routes/channels/#channel_id/messages/index.ts
index 1fe6d0ee..6741790c 100644
--- a/src/api/routes/channels/#channel_id/messages/index.ts
+++ b/src/api/routes/channels/#channel_id/messages/index.ts
@@ -171,11 +171,11 @@ router.get(
if ((y.user_ids || []).includes(req.user_id)) y.me = true;
delete y.user_ids;
});
- const { pomeloEnabled } = Config.get().general;
+ const { uniqueUsernames } = Config.get().general;
if (!x.author)
x.author = User.create({
id: "4",
- discriminator: pomeloEnabled ? "0" : "0000",
+ discriminator: uniqueUsernames ? "0" : "0000",
username: "spacebarghost",
global_name: "Spacebar Ghost",
public_flags: 0,
diff --git a/src/api/routes/users/@me/index.ts b/src/api/routes/users/@me/index.ts
index 1d209542..fc44e17e 100644
--- a/src/api/routes/users/@me/index.ts
+++ b/src/api/routes/users/@me/index.ts
@@ -140,7 +140,7 @@ router.patch(
newToken = (await generateToken(user.id)) as string;
}
- // TODO: pomelo: disallow if pomelo is enabled
+ // TODO: uniqueUsernames: disallow if uniqueUsernames is enabled
if (body.username) {
const check_username = body?.username?.replace(/\s/g, "");
if (!check_username) {
@@ -163,7 +163,7 @@ router.patch(
}
}
- // TODO: pomelo: disallow if pomelo is enabled
+ // TODO: uniqueUsernames: disallow if uniqueUsernames is enabled
if (body.discriminator) {
if (
await User.findOne({
diff --git a/src/api/routes/users/@me/relationships.ts b/src/api/routes/users/@me/relationships.ts
index 08342602..5fc55e58 100644
--- a/src/api/routes/users/@me/relationships.ts
+++ b/src/api/routes/users/@me/relationships.ts
@@ -114,10 +114,10 @@ router.post(
},
}),
async (req: Request, res: Response) => {
- const { pomeloEnabled } = Config.get().general;
- const where = pomeloEnabled
+ const { uniqueUsernames } = Config.get().general;
+ const where = uniqueUsernames
? {
- // TODO: pomelo: should we use username or add global_name property to the request?
+ // TODO: uniqueUsernames: should we use username or add global_name property to the request?
global_name: req.body.username,
}
: {
diff --git a/src/connections/Discord/index.ts b/src/connections/Discord/index.ts
index a88a38ce..35bae514 100644
--- a/src/connections/Discord/index.ts
+++ b/src/connections/Discord/index.ts
@@ -130,12 +130,12 @@ export default class DiscordConnection extends Connection {
if (exists) return null;
- const { pomeloEnabled } = Config.get().general;
+ const { uniqueUsernames } = Config.get().general;
return await this.createConnection({
user_id: userId,
external_id: userInfo.id,
friend_sync: params.friend_sync,
- name: pomeloEnabled
+ name: uniqueUsernames
? userInfo.username
: `${userInfo.username}#${userInfo.discriminator}`,
type: this.id,
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;
|