rename pomeloEnabled to uniqueUsernames

This commit is contained in:
Puyodead1
2023-05-19 15:14:40 -04:00
committed by Puyodead1
parent 0939236cc0
commit 84a69a8a68
9 changed files with 18 additions and 18 deletions
@@ -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,
+2 -2
View File
@@ -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({
+3 -3
View File
@@ -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,
}
: {