mirror of
https://github.com/spacebarchat/server.git
synced 2026-05-27 12:09:25 +00:00
rename pomeloEnabled to uniqueUsernames
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
: {
|
||||
|
||||
Reference in New Issue
Block a user