Fix bugs and add leave
This commit is contained in:
parent
5f168fc067
commit
a14be66890
2 changed files with 31 additions and 11 deletions
|
|
@ -69,15 +69,7 @@ const getLevel = (experience: number): ILevel => {
|
|||
};
|
||||
|
||||
const getUserName = (user: IUser): string => {
|
||||
const userPattern = /@[a-zA-Z0-9]*/;
|
||||
const match = user.id.match(userPattern)?.at(0);
|
||||
if (!match) {
|
||||
return "";
|
||||
}
|
||||
|
||||
let username = match.replaceAll("@", "");
|
||||
username = username.charAt(0).toUpperCase() + username.slice(1);
|
||||
return username;
|
||||
return getUserNameById(user.id);
|
||||
};
|
||||
|
||||
const getUserNameById = (userId: string): string => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue