Dynamic group link for more than 2 user fixed (#2416)

This commit is contained in:
Syed Ali Shahbaz authored and GitHub committed 2022-04-07 14:41:26 +01:00
1 parent 173e7846e8
commit a551919152
3 files changed
+17 -6

No files matched your search

+7 -1
View File
@@ -261,9 +261,15 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
eventTypeObject.schedule = null;
eventTypeObject.availability = [];
const dynamicNames = isDynamicGroup
? users.map((user) => {
return user.name || "";
})
: [];
const profile = isDynamicGroup
? {
name: getGroupName(usernameList),
name: getGroupName(dynamicNames),
image: null,
slug: typeParam,
theme: null,
+7 -1
View File
@@ -168,9 +168,15 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
const isDynamicGroupBooking = users.length > 1;
const dynamicNames = isDynamicGroupBooking
? users.map((user) => {
return user.name || "";
})
: [];
const profile = isDynamicGroupBooking
? {
name: getGroupName(usernameList),
name: getGroupName(dynamicNames),
image: null,
slug: eventTypeSlug,
theme: null,
+3 -4
View File
@@ -126,11 +126,10 @@ export const getGroupName = (usernameList: string[]): string => {
export const getUsernameSlugLink = ({ users, slug }: UsernameSlugLinkProps): string => {
let slugLink = ``;
if (users.length > 1) {
let combinedUsername = ``;
for (let i = 0; i < users.length - 1; i++) {
combinedUsername = `${users[i].username}+`;
let combinedUsername = `${users[0].username}`;
for (let i = 1; i < users.length; i++) {
combinedUsername = `${combinedUsername}+${users[i].username}`;
}
combinedUsername = `${combinedUsername}${users[users.length - 1].username}`;
slugLink = `/${combinedUsername}/${slug}`;
} else {
slugLink = `/${users[0].username}/${slug}`;