mirror of
https://github.com/spacebarchat/server.git
synced 2026-08-27 22:34:11 +00:00
Port User.tag getter from pomelo as utility
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -68,7 +68,7 @@ router.post(
|
||||
|
||||
if (user && user.email) {
|
||||
Email.sendResetPassword(user, user.email).catch((e) => {
|
||||
console.error(`Failed to send password reset email to ${user.username}#${user.discriminator} (${user.id}): ${e}`);
|
||||
console.error(`Failed to send password reset email to ${user.tag} (${user.id}): ${e}`);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -56,7 +56,7 @@ router.post(
|
||||
return res.sendStatus(204);
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error(`Failed to send verification email to ${user.username}#${user.discriminator}: ${e}`);
|
||||
console.error(`Failed to send verification email to ${user.tag}: ${e}`);
|
||||
throw new HTTPError("Failed to send verification email", 500);
|
||||
});
|
||||
},
|
||||
|
||||
@@ -245,6 +245,13 @@ export class User extends BaseClass {
|
||||
}
|
||||
}
|
||||
|
||||
public get tag(): string {
|
||||
//const { uniqueUsernames } = Config.get().general;
|
||||
const uniqueUsernames = false;
|
||||
|
||||
return uniqueUsernames ? this.username : `${this.username}#${this.discriminator}`;
|
||||
}
|
||||
|
||||
static async register({
|
||||
email,
|
||||
username,
|
||||
@@ -310,7 +317,7 @@ export class User extends BaseClass {
|
||||
// send verification email if users aren't verified by default and we have an email
|
||||
if (!Config.get().defaults.user.verified && email) {
|
||||
await Email.sendVerifyEmail(user, email).catch((e) => {
|
||||
console.error(`Failed to send verification email to ${user.username}#${user.discriminator}: ${e}`);
|
||||
console.error(`Failed to send verification email to ${user.tag}: ${e}`);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user