diff --git a/src/api/routes/users/@me/index.ts b/src/api/routes/users/@me/index.ts
index ad11a428..1d209542 100644
--- a/src/api/routes/users/@me/index.ts
+++ b/src/api/routes/users/@me/index.ts
@@ -140,6 +140,7 @@ router.patch(
newToken = (await generateToken(user.id)) as string;
}
+ // TODO: pomelo: disallow if pomelo is enabled
if (body.username) {
const check_username = body?.username?.replace(/\s/g, "");
if (!check_username) {
@@ -162,6 +163,7 @@ router.patch(
}
}
+ // TODO: pomelo: disallow if pomelo 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 bce0a654..08342602 100644
--- a/src/api/routes/users/@me/relationships.ts
+++ b/src/api/routes/users/@me/relationships.ts
@@ -114,19 +114,26 @@ router.post(
},
}),
async (req: Request, res: Response) => {
+ const { pomeloEnabled } = Config.get().general;
+ const where = pomeloEnabled
+ ? {
+ // TODO: pomelo: should we use username or add global_name property to the request?
+ global_name: req.body.username,
+ }
+ : {
+ discriminator: String(req.body.discriminator).padStart(
+ 4,
+ "0",
+ ), //Discord send the discriminator as integer, we need to add leading zeroes
+ username: req.body.username,
+ };
return await updateRelationship(
req,
res,
await User.findOneOrFail({
relations: ["relationships", "relationships.to"],
select: userProjection,
- where: {
- discriminator: String(req.body.discriminator).padStart(
- 4,
- "0",
- ), //Discord send the discriminator as integer, we need to add leading zeroes
- username: req.body.username,
- },
+ where,
}),
req.body.type,
);
|