Bug - link not showing (#2333)
* Bug - link not showing * Added where location as link on emails * Location URL test fixes * URLs validator fixes Co-authored-by: Alan <alannnc@gmail.com> Co-authored-by: zomars <zomars@me.com>
This commit is contained in:
		
							parent
							
								
									0494fccb8e
								
							
						
					
					
						commit
						f293f8b5c4
					
				
					 3 changed files with 14 additions and 2 deletions
				
			
		| 
						 | 
					@ -114,7 +114,7 @@ const BookingPage = ({ eventType, booking, profile }: BookingPageProps) => {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const eventTypeDetail = { isWeb3Active: false, ...eventType };
 | 
					  const eventTypeDetail = { isWeb3Active: false, ...eventType };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  type Location = { type: LocationType; address?: string };
 | 
					  type Location = { type: LocationType; address?: string; link?: string };
 | 
				
			||||||
  // it would be nice if Prisma at some point in the future allowed for Json<Location>; as of now this is not the case.
 | 
					  // it would be nice if Prisma at some point in the future allowed for Json<Location>; as of now this is not the case.
 | 
				
			||||||
  const locations: Location[] = useMemo(
 | 
					  const locations: Location[] = useMemo(
 | 
				
			||||||
    () => (eventType.locations as Location[]) || [],
 | 
					    () => (eventType.locations as Location[]) || [],
 | 
				
			||||||
| 
						 | 
					@ -201,6 +201,9 @@ const BookingPage = ({ eventType, booking, profile }: BookingPageProps) => {
 | 
				
			||||||
      case LocationType.InPerson: {
 | 
					      case LocationType.InPerson: {
 | 
				
			||||||
        return locationInfo(locationType)?.address || "";
 | 
					        return locationInfo(locationType)?.address || "";
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					      case LocationType.Link: {
 | 
				
			||||||
 | 
					        return locationInfo(locationType)?.link || "";
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
      // Catches all other location types, such as Google Meet, Zoom etc.
 | 
					      // Catches all other location types, such as Google Meet, Zoom etc.
 | 
				
			||||||
      default:
 | 
					      default:
 | 
				
			||||||
        return selectedLocation || "";
 | 
					        return selectedLocation || "";
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -310,12 +310,16 @@ ${getRichDescription(this.calEvent)}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  protected getLocation(): string {
 | 
					  protected getLocation(): string {
 | 
				
			||||||
    let providerName = this.calEvent.location ? getAppName(this.calEvent.location) : "";
 | 
					    let providerName = this.calEvent.location ? getAppName(this.calEvent.location) : "";
 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (this.calEvent.location && this.calEvent.location.includes("integrations:")) {
 | 
					    if (this.calEvent.location && this.calEvent.location.includes("integrations:")) {
 | 
				
			||||||
      const location = this.calEvent.location.split(":")[1];
 | 
					      const location = this.calEvent.location.split(":")[1];
 | 
				
			||||||
      providerName = location[0].toUpperCase() + location.slice(1);
 | 
					      providerName = location[0].toUpperCase() + location.slice(1);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // If location its a url, probably we should be validating it with a custom library
 | 
				
			||||||
 | 
					    if (this.calEvent.location && /^https?:\/\//.test(this.calEvent.location)) {
 | 
				
			||||||
 | 
					      providerName = this.calEvent.location;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (this.calEvent.videoCallData) {
 | 
					    if (this.calEvent.videoCallData) {
 | 
				
			||||||
      const meetingId = this.calEvent.videoCallData.id;
 | 
					      const meetingId = this.calEvent.videoCallData.id;
 | 
				
			||||||
      const meetingPassword = this.calEvent.videoCallData.password;
 | 
					      const meetingPassword = this.calEvent.videoCallData.password;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -307,6 +307,11 @@ ${getRichDescription(this.calEvent)}
 | 
				
			||||||
      providerName = location[0].toUpperCase() + location.slice(1);
 | 
					      providerName = location[0].toUpperCase() + location.slice(1);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // If location its a url, probably we should be validating it with a custom library
 | 
				
			||||||
 | 
					    if (this.calEvent.location && /^https?:\/\//.test(this.calEvent.location)) {
 | 
				
			||||||
 | 
					      providerName = this.calEvent.location;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (this.calEvent.videoCallData) {
 | 
					    if (this.calEvent.videoCallData) {
 | 
				
			||||||
      const meetingId = this.calEvent.videoCallData.id;
 | 
					      const meetingId = this.calEvent.videoCallData.id;
 | 
				
			||||||
      const meetingPassword = this.calEvent.videoCallData.password;
 | 
					      const meetingPassword = this.calEvent.videoCallData.password;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue