Hotfix for merge loss in PR2416 (#2418)

pull/2404/head^2
Syed Ali Shahbaz 2022-04-07 20:04:11 +05:30 committed by GitHub
parent a551919152
commit e6587efd27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 7 deletions

View File

@ -126,10 +126,7 @@ export const getGroupName = (usernameList: string[]): string => {
export const getUsernameSlugLink = ({ users, slug }: UsernameSlugLinkProps): string => {
let slugLink = ``;
if (users.length > 1) {
let combinedUsername = `${users[0].username}`;
for (let i = 1; i < users.length; i++) {
combinedUsername = `${combinedUsername}+${users[i].username}`;
}
const combinedUsername = users.map((user) => user.username).join("+");
slugLink = `/${combinedUsername}/${slug}`;
} else {
slugLink = `/${users[0].username}/${slug}`;
@ -138,11 +135,10 @@ export const getUsernameSlugLink = ({ users, slug }: UsernameSlugLinkProps): str
};
export const getUsernameList = (users: string): string[] => {
// For Team booking, users might be undefined
return users
?.toLowerCase()
.replace(" ", "+")
.replace("%20", "+")
.replace(/ /g, "+")
.replace(/%20/g, "+")
.split("+")
.filter((el) => {
return el.length != 0;