Show eventDescription on email (#2371)
* Show eventDescription on email * Fixing Inheritance * Fixing Duplicate getLocation * Type fixes Co-authored-by: zomars <zomars@me.com>
This commit is contained in:
		
							parent
							
								
									5e7d34b9c4
								
							
						
					
					
						commit
						96f6294542
					
				
					 17 changed files with 67 additions and 13 deletions
				
			
		| 
						 | 
					@ -48,6 +48,7 @@ ${this.attendee.language.translate("emailed_you_and_any_other_attendees")}
 | 
				
			||||||
${this.getWhat()}
 | 
					${this.getWhat()}
 | 
				
			||||||
${this.getWhen()}
 | 
					${this.getWhen()}
 | 
				
			||||||
${this.getLocation()}
 | 
					${this.getLocation()}
 | 
				
			||||||
 | 
					${this.getDescription()}
 | 
				
			||||||
${this.getAdditionalNotes()}
 | 
					${this.getAdditionalNotes()}
 | 
				
			||||||
`.replace(/(<([^>]+)>)/gi, "");
 | 
					`.replace(/(<([^>]+)>)/gi, "");
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					@ -94,6 +95,7 @@ ${this.getAdditionalNotes()}
 | 
				
			||||||
                              ${this.getWhen()}
 | 
					                              ${this.getWhen()}
 | 
				
			||||||
                              ${this.getWho()}
 | 
					                              ${this.getWho()}
 | 
				
			||||||
                              ${this.getLocation()}
 | 
					                              ${this.getLocation()}
 | 
				
			||||||
 | 
					                              ${this.getDescription()}
 | 
				
			||||||
                              ${this.getAdditionalNotes()}
 | 
					                              ${this.getAdditionalNotes()}
 | 
				
			||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
                          </td>
 | 
					                          </td>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -47,6 +47,7 @@ ${this.attendee.language.translate("emailed_you_and_any_other_attendees")}
 | 
				
			||||||
${this.getWhat()}
 | 
					${this.getWhat()}
 | 
				
			||||||
${this.getWhen()}
 | 
					${this.getWhen()}
 | 
				
			||||||
${this.getLocation()}
 | 
					${this.getLocation()}
 | 
				
			||||||
 | 
					${this.getDescription()}
 | 
				
			||||||
${this.getAdditionalNotes()}
 | 
					${this.getAdditionalNotes()}
 | 
				
			||||||
${this.calEvent.cancellationReason && this.getCancellationReason()}
 | 
					${this.calEvent.cancellationReason && this.getCancellationReason()}
 | 
				
			||||||
`.replace(/(<([^>]+)>)/gi, "");
 | 
					`.replace(/(<([^>]+)>)/gi, "");
 | 
				
			||||||
| 
						 | 
					@ -95,6 +96,7 @@ ${this.calEvent.cancellationReason && this.getCancellationReason()}
 | 
				
			||||||
                              ${this.getWhen()}
 | 
					                              ${this.getWhen()}
 | 
				
			||||||
                              ${this.getWho()}
 | 
					                              ${this.getWho()}
 | 
				
			||||||
                              ${this.getLocation()}
 | 
					                              ${this.getLocation()}
 | 
				
			||||||
 | 
					                              ${this.getDescription()}
 | 
				
			||||||
                              ${this.getAdditionalNotes()}
 | 
					                              ${this.getAdditionalNotes()}
 | 
				
			||||||
                              ${this.calEvent.cancellationReason && this.getCancellationReason()}
 | 
					                              ${this.calEvent.cancellationReason && this.getCancellationReason()}
 | 
				
			||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -47,6 +47,7 @@ ${this.attendee.language.translate("emailed_you_and_any_other_attendees")}
 | 
				
			||||||
${this.getWhat()}
 | 
					${this.getWhat()}
 | 
				
			||||||
${this.getWhen()}
 | 
					${this.getWhen()}
 | 
				
			||||||
${this.getLocation()}
 | 
					${this.getLocation()}
 | 
				
			||||||
 | 
					${this.getDescription()}
 | 
				
			||||||
${this.getAdditionalNotes()}
 | 
					${this.getAdditionalNotes()}
 | 
				
			||||||
${this.getRejectionReason()}
 | 
					${this.getRejectionReason()}
 | 
				
			||||||
`.replace(/(<([^>]+)>)/gi, "");
 | 
					`.replace(/(<([^>]+)>)/gi, "");
 | 
				
			||||||
| 
						 | 
					@ -95,6 +96,7 @@ ${this.getRejectionReason()}
 | 
				
			||||||
                              ${this.getWhen()}
 | 
					                              ${this.getWhen()}
 | 
				
			||||||
                              ${this.getWho()}
 | 
					                              ${this.getWho()}
 | 
				
			||||||
                              ${this.getLocation()}
 | 
					                              ${this.getLocation()}
 | 
				
			||||||
 | 
					                              ${this.getDescription()}
 | 
				
			||||||
                              ${this.getAdditionalNotes()}
 | 
					                              ${this.getAdditionalNotes()}
 | 
				
			||||||
                              ${this.getRejectionReason()}
 | 
					                              ${this.getRejectionReason()}
 | 
				
			||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -60,6 +60,7 @@ ${this.calEvent.attendees[0].language.translate("user_needs_to_confirm_or_reject
 | 
				
			||||||
${this.getWhat()}
 | 
					${this.getWhat()}
 | 
				
			||||||
${this.getWhen()}
 | 
					${this.getWhen()}
 | 
				
			||||||
${this.getLocation()}
 | 
					${this.getLocation()}
 | 
				
			||||||
 | 
					${this.getDescription()}
 | 
				
			||||||
${this.getAdditionalNotes()}
 | 
					${this.getAdditionalNotes()}
 | 
				
			||||||
`.replace(/(<([^>]+)>)/gi, "");
 | 
					`.replace(/(<([^>]+)>)/gi, "");
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					@ -109,6 +110,7 @@ ${this.getAdditionalNotes()}
 | 
				
			||||||
                              ${this.getWhen()}
 | 
					                              ${this.getWhen()}
 | 
				
			||||||
                              ${this.getWho()}
 | 
					                              ${this.getWho()}
 | 
				
			||||||
                              ${this.getLocation()}
 | 
					                              ${this.getLocation()}
 | 
				
			||||||
 | 
					                              ${this.getDescription()}
 | 
				
			||||||
                              ${this.getAdditionalNotes()}
 | 
					                              ${this.getAdditionalNotes()}
 | 
				
			||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
                          </td>
 | 
					                          </td>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -45,7 +45,6 @@ export default class AttendeeRescheduledEmail extends AttendeeScheduledEmail {
 | 
				
			||||||
      text: this.getTextBody(),
 | 
					      text: this.getTextBody(),
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					 | 
				
			||||||
  protected getTextBody(): string {
 | 
					  protected getTextBody(): string {
 | 
				
			||||||
    // Only the original attendee can make changes to the event
 | 
					    // Only the original attendee can make changes to the event
 | 
				
			||||||
    // Guests cannot
 | 
					    // Guests cannot
 | 
				
			||||||
| 
						 | 
					@ -56,6 +55,7 @@ export default class AttendeeRescheduledEmail extends AttendeeScheduledEmail {
 | 
				
			||||||
  ${this.getWhat()}
 | 
					  ${this.getWhat()}
 | 
				
			||||||
  ${this.getWhen()}
 | 
					  ${this.getWhen()}
 | 
				
			||||||
  ${this.getLocation()}
 | 
					  ${this.getLocation()}
 | 
				
			||||||
 | 
					  ${this.getDescription()}
 | 
				
			||||||
  ${this.getAdditionalNotes()}
 | 
					  ${this.getAdditionalNotes()}
 | 
				
			||||||
  ${this.attendee.language.translate("need_to_reschedule_or_cancel")}
 | 
					  ${this.attendee.language.translate("need_to_reschedule_or_cancel")}
 | 
				
			||||||
  ${getCancelLink(this.calEvent)}
 | 
					  ${getCancelLink(this.calEvent)}
 | 
				
			||||||
| 
						 | 
					@ -114,6 +114,7 @@ ${this.getAdditionalNotes()}
 | 
				
			||||||
                              ${this.getWhen()}
 | 
					                              ${this.getWhen()}
 | 
				
			||||||
                              ${this.getWho()}
 | 
					                              ${this.getWho()}
 | 
				
			||||||
                              ${this.getLocation()}
 | 
					                              ${this.getLocation()}
 | 
				
			||||||
 | 
					                              ${this.getDescription()}
 | 
				
			||||||
                              ${this.getAdditionalNotes()}
 | 
					                              ${this.getAdditionalNotes()}
 | 
				
			||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
                          </td>
 | 
					                          </td>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -112,7 +112,18 @@ export default class AttendeeScheduledEmail {
 | 
				
			||||||
      from: serverConfig.from,
 | 
					      from: serverConfig.from,
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  protected getDescription(): string {
 | 
				
			||||||
 | 
					    if (!this.calEvent.description) return "";
 | 
				
			||||||
 | 
					    return `
 | 
				
			||||||
 | 
					    <p style="height: 6px"></p>
 | 
				
			||||||
 | 
					    <div style="line-height: 6px;">
 | 
				
			||||||
 | 
					      <p style="color: #494949;">${this.calEvent.organizer.language.translate("description")}</p>
 | 
				
			||||||
 | 
					      <p style="color: #494949; font-weight: 400; line-height: 24px; white-space: pre-wrap;">${
 | 
				
			||||||
 | 
					        this.calEvent.description
 | 
				
			||||||
 | 
					      }</p>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					    `;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
  protected getTextBody(): string {
 | 
					  protected getTextBody(): string {
 | 
				
			||||||
    return `
 | 
					    return `
 | 
				
			||||||
${this.calEvent.attendees[0].language.translate("your_event_has_been_scheduled")}
 | 
					${this.calEvent.attendees[0].language.translate("your_event_has_been_scheduled")}
 | 
				
			||||||
| 
						 | 
					@ -168,6 +179,7 @@ ${getRichDescription(this.calEvent)}
 | 
				
			||||||
                              ${this.getWhen()}
 | 
					                              ${this.getWhen()}
 | 
				
			||||||
                              ${this.getWho()}
 | 
					                              ${this.getWho()}
 | 
				
			||||||
                              ${this.getLocation()}
 | 
					                              ${this.getLocation()}
 | 
				
			||||||
 | 
					                              ${this.getDescription()}
 | 
				
			||||||
                              ${this.getAdditionalNotes()}
 | 
					                              ${this.getAdditionalNotes()}
 | 
				
			||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
                          </td>
 | 
					                          </td>
 | 
				
			||||||
| 
						 | 
					@ -286,13 +298,13 @@ ${getRichDescription(this.calEvent)}
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  protected getAdditionalNotes(): string {
 | 
					  protected getAdditionalNotes(): string {
 | 
				
			||||||
    if (!this.calEvent.description) return "";
 | 
					    if (!this.calEvent.additionalNotes) return "";
 | 
				
			||||||
    return `
 | 
					    return `
 | 
				
			||||||
    <p style="height: 6px"></p>
 | 
					    <p style="height: 6px"></p>
 | 
				
			||||||
    <div style="line-height: 6px;">
 | 
					    <div style="line-height: 6px;">
 | 
				
			||||||
      <p style="color: #494949;">${this.calEvent.attendees[0].language.translate("additional_notes")}</p>
 | 
					      <p style="color: #494949;">${this.calEvent.attendees[0].language.translate("additional_notes")}</p>
 | 
				
			||||||
      <p style="color: #494949; font-weight: 400; line-height: 24px; white-space: pre-wrap;">${
 | 
					      <p style="color: #494949; font-weight: 400; line-height: 24px; white-space: pre-wrap;">${
 | 
				
			||||||
        this.calEvent.description
 | 
					        this.calEvent.additionalNotes
 | 
				
			||||||
      }</p>
 | 
					      }</p>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
    `;
 | 
					    `;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -56,6 +56,7 @@ ${this.calEvent.organizer.language.translate("emailed_you_and_any_other_attendee
 | 
				
			||||||
${this.getWhat()}
 | 
					${this.getWhat()}
 | 
				
			||||||
${this.getWhen()}
 | 
					${this.getWhen()}
 | 
				
			||||||
${this.getLocation()}
 | 
					${this.getLocation()}
 | 
				
			||||||
 | 
					${this.getDescription()}
 | 
				
			||||||
${this.getAdditionalNotes()}
 | 
					${this.getAdditionalNotes()}
 | 
				
			||||||
${this.calEvent.cancellationReason && this.getCancellationReason()}
 | 
					${this.calEvent.cancellationReason && this.getCancellationReason()}
 | 
				
			||||||
`.replace(/(<([^>]+)>)/gi, "");
 | 
					`.replace(/(<([^>]+)>)/gi, "");
 | 
				
			||||||
| 
						 | 
					@ -103,6 +104,7 @@ ${this.calEvent.cancellationReason && this.getCancellationReason()}
 | 
				
			||||||
                              ${this.getWhen()}
 | 
					                              ${this.getWhen()}
 | 
				
			||||||
                              ${this.getWho()}
 | 
					                              ${this.getWho()}
 | 
				
			||||||
                              ${this.getLocation()}
 | 
					                              ${this.getLocation()}
 | 
				
			||||||
 | 
					                              ${this.getDescription()}
 | 
				
			||||||
                              ${this.getAdditionalNotes()}
 | 
					                              ${this.getAdditionalNotes()}
 | 
				
			||||||
                              ${this.calEvent.cancellationReason && this.getCancellationReason()}
 | 
					                              ${this.calEvent.cancellationReason && this.getCancellationReason()}
 | 
				
			||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -58,6 +58,7 @@ ${
 | 
				
			||||||
${this.getWhat()}
 | 
					${this.getWhat()}
 | 
				
			||||||
${this.getWhen()}
 | 
					${this.getWhen()}
 | 
				
			||||||
${this.getLocation()}
 | 
					${this.getLocation()}
 | 
				
			||||||
 | 
					${this.getDescription()}
 | 
				
			||||||
${this.getAdditionalNotes()}
 | 
					${this.getAdditionalNotes()}
 | 
				
			||||||
`.replace(/(<([^>]+)>)/gi, "");
 | 
					`.replace(/(<([^>]+)>)/gi, "");
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					@ -136,6 +137,7 @@ ${this.getAdditionalNotes()}
 | 
				
			||||||
                              ${this.getWhen()}
 | 
					                              ${this.getWhen()}
 | 
				
			||||||
                              ${this.getWho()}
 | 
					                              ${this.getWho()}
 | 
				
			||||||
                              ${this.getLocation()}
 | 
					                              ${this.getLocation()}
 | 
				
			||||||
 | 
					                              ${this.getDescription()}
 | 
				
			||||||
                              ${this.getAdditionalNotes()}
 | 
					                              ${this.getAdditionalNotes()}
 | 
				
			||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
                          </td>
 | 
					                          </td>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -57,6 +57,7 @@ ${this.calEvent.organizer.language.translate("someone_requested_an_event")}
 | 
				
			||||||
${this.getWhat()}
 | 
					${this.getWhat()}
 | 
				
			||||||
${this.getWhen()}
 | 
					${this.getWhen()}
 | 
				
			||||||
${this.getLocation()}
 | 
					${this.getLocation()}
 | 
				
			||||||
 | 
					${this.getDescription()}
 | 
				
			||||||
${this.getAdditionalNotes()}
 | 
					${this.getAdditionalNotes()}
 | 
				
			||||||
${this.calEvent.organizer.language.translate("confirm_or_reject_request")}
 | 
					${this.calEvent.organizer.language.translate("confirm_or_reject_request")}
 | 
				
			||||||
${process.env.NEXT_PUBLIC_WEBAPP_URL} + "/bookings/upcoming"
 | 
					${process.env.NEXT_PUBLIC_WEBAPP_URL} + "/bookings/upcoming"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -57,6 +57,7 @@ ${this.calEvent.organizer.language.translate("someone_requested_an_event")}
 | 
				
			||||||
${this.getWhat()}
 | 
					${this.getWhat()}
 | 
				
			||||||
${this.getWhen()}
 | 
					${this.getWhen()}
 | 
				
			||||||
${this.getLocation()}
 | 
					${this.getLocation()}
 | 
				
			||||||
 | 
					${this.getDescription()}
 | 
				
			||||||
${this.getAdditionalNotes()}
 | 
					${this.getAdditionalNotes()}
 | 
				
			||||||
${this.calEvent.organizer.language.translate("confirm_or_reject_request")}
 | 
					${this.calEvent.organizer.language.translate("confirm_or_reject_request")}
 | 
				
			||||||
${process.env.NEXT_PUBLIC_WEBAPP_URL} + "/bookings/upcoming"
 | 
					${process.env.NEXT_PUBLIC_WEBAPP_URL} + "/bookings/upcoming"
 | 
				
			||||||
| 
						 | 
					@ -105,6 +106,7 @@ ${process.env.NEXT_PUBLIC_WEBAPP_URL} + "/bookings/upcoming"
 | 
				
			||||||
                              ${this.getWhen()}
 | 
					                              ${this.getWhen()}
 | 
				
			||||||
                              ${this.getWho()}
 | 
					                              ${this.getWho()}
 | 
				
			||||||
                              ${this.getLocation()}
 | 
					                              ${this.getLocation()}
 | 
				
			||||||
 | 
					                              ${this.getDescription()}
 | 
				
			||||||
                              ${this.getAdditionalNotes()}
 | 
					                              ${this.getAdditionalNotes()}
 | 
				
			||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
                          </td>
 | 
					                          </td>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -62,6 +62,7 @@ ${this.calEvent.organizer.language.translate("emailed_you_and_any_other_attendee
 | 
				
			||||||
${this.getWhat()}
 | 
					${this.getWhat()}
 | 
				
			||||||
${this.getWhen()}
 | 
					${this.getWhen()}
 | 
				
			||||||
${this.getLocation()}
 | 
					${this.getLocation()}
 | 
				
			||||||
 | 
					${this.getDescription()}
 | 
				
			||||||
${this.getAdditionalNotes()}
 | 
					${this.getAdditionalNotes()}
 | 
				
			||||||
${this.calEvent.organizer.language.translate("need_to_reschedule_or_cancel")}
 | 
					${this.calEvent.organizer.language.translate("need_to_reschedule_or_cancel")}
 | 
				
			||||||
${getCancelLink(this.calEvent)}
 | 
					${getCancelLink(this.calEvent)}
 | 
				
			||||||
| 
						 | 
					@ -110,6 +111,7 @@ ${getCancelLink(this.calEvent)}
 | 
				
			||||||
                              ${this.getWhen()}
 | 
					                              ${this.getWhen()}
 | 
				
			||||||
                              ${this.getWho()}
 | 
					                              ${this.getWho()}
 | 
				
			||||||
                              ${this.getLocation()}
 | 
					                              ${this.getLocation()}
 | 
				
			||||||
 | 
					                              ${this.getDescription()}
 | 
				
			||||||
                              ${this.getAdditionalNotes()}
 | 
					                              ${this.getAdditionalNotes()}
 | 
				
			||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
                          </td>
 | 
					                          </td>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -175,6 +175,7 @@ ${getRichDescription(this.calEvent)}
 | 
				
			||||||
                              ${this.getWhen()}
 | 
					                              ${this.getWhen()}
 | 
				
			||||||
                              ${this.getWho()}
 | 
					                              ${this.getWho()}
 | 
				
			||||||
                              ${this.getLocation()}
 | 
					                              ${this.getLocation()}
 | 
				
			||||||
 | 
					                              ${this.getDescription()}
 | 
				
			||||||
                              ${this.getAdditionalNotes()}
 | 
					                              ${this.getAdditionalNotes()}
 | 
				
			||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
                          </td>
 | 
					                          </td>
 | 
				
			||||||
| 
						 | 
					@ -287,11 +288,24 @@ ${getRichDescription(this.calEvent)}
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  protected getAdditionalNotes(): string {
 | 
					  protected getAdditionalNotes(): string {
 | 
				
			||||||
    if (!this.calEvent.description) return "";
 | 
					    if (!this.calEvent.additionalNotes) return "";
 | 
				
			||||||
    return `
 | 
					    return `
 | 
				
			||||||
    <p style="height: 6px"></p>
 | 
					    <p style="height: 6px"></p>
 | 
				
			||||||
    <div style="line-height: 6px;">
 | 
					    <div style="line-height: 6px;">
 | 
				
			||||||
      <p style="color: #494949;">${this.calEvent.organizer.language.translate("additional_notes")}</p>
 | 
					      <p style="color: #494949;">${this.calEvent.organizer.language.translate("additional_notes")}</p>
 | 
				
			||||||
 | 
					      <p style="color: #494949; font-weight: 400; line-height: 24px; white-space: pre-wrap;">${
 | 
				
			||||||
 | 
					        this.calEvent.additionalNotes
 | 
				
			||||||
 | 
					      }</p>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					    `;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  protected getDescription(): string {
 | 
				
			||||||
 | 
					    if (!this.calEvent.description) return "";
 | 
				
			||||||
 | 
					    return `
 | 
				
			||||||
 | 
					    <p style="height: 6px"></p>
 | 
				
			||||||
 | 
					    <div style="line-height: 6px;">
 | 
				
			||||||
 | 
					      <p style="color: #494949;">${this.calEvent.organizer.language.translate("description")}</p>
 | 
				
			||||||
      <p style="color: #494949; font-weight: 400; line-height: 24px; white-space: pre-wrap;">${
 | 
					      <p style="color: #494949; font-weight: 400; line-height: 24px; white-space: pre-wrap;">${
 | 
				
			||||||
        this.calEvent.description
 | 
					        this.calEvent.description
 | 
				
			||||||
      }</p>
 | 
					      }</p>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -200,6 +200,7 @@ const getEventTypesFromDB = async (eventTypeId: number) => {
 | 
				
			||||||
      length: true,
 | 
					      length: true,
 | 
				
			||||||
      eventName: true,
 | 
					      eventName: true,
 | 
				
			||||||
      schedulingType: true,
 | 
					      schedulingType: true,
 | 
				
			||||||
 | 
					      description: true,
 | 
				
			||||||
      periodType: true,
 | 
					      periodType: true,
 | 
				
			||||||
      periodStartDate: true,
 | 
					      periodStartDate: true,
 | 
				
			||||||
      periodEndDate: true,
 | 
					      periodEndDate: true,
 | 
				
			||||||
| 
						 | 
					@ -337,7 +338,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
 | 
				
			||||||
    t: tOrganizer,
 | 
					    t: tOrganizer,
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const description =
 | 
					  const additionalNotes =
 | 
				
			||||||
    reqBody.notes +
 | 
					    reqBody.notes +
 | 
				
			||||||
    reqBody.customInputs.reduce(
 | 
					    reqBody.customInputs.reduce(
 | 
				
			||||||
      (str, input) => str + "<br /><br />" + input.label + ":<br />" + input.value,
 | 
					      (str, input) => str + "<br /><br />" + input.label + ":<br />" + input.value,
 | 
				
			||||||
| 
						 | 
					@ -346,7 +347,8 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
 | 
				
			||||||
  const evt: CalendarEvent = {
 | 
					  const evt: CalendarEvent = {
 | 
				
			||||||
    type: eventType.title,
 | 
					    type: eventType.title,
 | 
				
			||||||
    title: getEventName(eventNameObject), //this needs to be either forced in english, or fetched for each attendee and organizer separately
 | 
					    title: getEventName(eventNameObject), //this needs to be either forced in english, or fetched for each attendee and organizer separately
 | 
				
			||||||
    description,
 | 
					    description: eventType.description,
 | 
				
			||||||
 | 
					    additionalNotes,
 | 
				
			||||||
    startTime: reqBody.start,
 | 
					    startTime: reqBody.start,
 | 
				
			||||||
    endTime: reqBody.end,
 | 
					    endTime: reqBody.end,
 | 
				
			||||||
    organizer: {
 | 
					    organizer: {
 | 
				
			||||||
| 
						 | 
					@ -402,7 +404,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
 | 
				
			||||||
        title: evt.title,
 | 
					        title: evt.title,
 | 
				
			||||||
        startTime: dayjs(evt.startTime).toDate(),
 | 
					        startTime: dayjs(evt.startTime).toDate(),
 | 
				
			||||||
        endTime: dayjs(evt.endTime).toDate(),
 | 
					        endTime: dayjs(evt.endTime).toDate(),
 | 
				
			||||||
        description: evt.description,
 | 
					        description: evt.additionalNotes,
 | 
				
			||||||
        confirmed: (!eventType.requiresConfirmation && !eventType.price) || !!rescheduleUid,
 | 
					        confirmed: (!eventType.requiresConfirmation && !eventType.price) || !!rescheduleUid,
 | 
				
			||||||
        location: evt.location,
 | 
					        location: evt.location,
 | 
				
			||||||
        eventType: eventTypeRel,
 | 
					        eventType: eventTypeRel,
 | 
				
			||||||
| 
						 | 
					@ -557,7 +559,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
 | 
				
			||||||
    const updateManager = await eventManager.update(evt, rescheduleUid);
 | 
					    const updateManager = await eventManager.update(evt, rescheduleUid);
 | 
				
			||||||
    // This gets overridden when updating the event - to check if notes have been hidden or not. We just reset this back
 | 
					    // This gets overridden when updating the event - to check if notes have been hidden or not. We just reset this back
 | 
				
			||||||
    // to the default description when we are sending the emails.
 | 
					    // to the default description when we are sending the emails.
 | 
				
			||||||
    evt.description = description;
 | 
					    evt.description = eventType.description;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    results = updateManager.results;
 | 
					    results = updateManager.results;
 | 
				
			||||||
    referencesToCreate = updateManager.referencesToCreate;
 | 
					    referencesToCreate = updateManager.referencesToCreate;
 | 
				
			||||||
| 
						 | 
					@ -594,7 +596,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // This gets overridden when creating the event - to check if notes have been hidden or not. We just reset this back
 | 
					    // This gets overridden when creating the event - to check if notes have been hidden or not. We just reset this back
 | 
				
			||||||
    // to the default description when we are sending the emails.
 | 
					    // to the default description when we are sending the emails.
 | 
				
			||||||
    evt.description = description;
 | 
					    evt.description = eventType.description;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    results = createManager.results;
 | 
					    results = createManager.results;
 | 
				
			||||||
    referencesToCreate = createManager.referencesToCreate;
 | 
					    referencesToCreate = createManager.referencesToCreate;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1 +1 @@
 | 
				
			||||||
{"triggerEvent":"BOOKING_CREATED","createdAt":"[redacted/dynamic]","payload":{"type":"30min","title":"30min between Pro Example and Test Testson","description":"","startTime":"[redacted/dynamic]","endTime":"[redacted/dynamic]","organizer":{"name":"Pro Example","email":"pro@example.com","timeZone":"[redacted/dynamic]","language":"[redacted/dynamic]"},"attendees":[{"email":"test@example.com","name":"Test Testson","timeZone":"[redacted/dynamic]","language":"[redacted/dynamic]"}],"location":"[redacted/dynamic]","destinationCalendar":null,"hideCalendarNotes":false,"uid":"[redacted/dynamic]","metadata":{},"additionInformation":"[redacted/dynamic]"}}
 | 
					{"triggerEvent":"BOOKING_CREATED","createdAt":"[redacted/dynamic]","payload":{"type":"30min","title":"30min between Pro Example and Test Testson","description":null,"additionalNotes":"","startTime":"[redacted/dynamic]","endTime":"[redacted/dynamic]","organizer":{"name":"Pro Example","email":"pro@example.com","timeZone":"[redacted/dynamic]","language":"[redacted/dynamic]"},"attendees":[{"email":"test@example.com","name":"Test Testson","timeZone":"[redacted/dynamic]","language":"[redacted/dynamic]"}],"location":"[redacted/dynamic]","destinationCalendar":null,"hideCalendarNotes":false,"uid":"[redacted/dynamic]","metadata":{},"additionInformation":"[redacted/dynamic]"}}
 | 
				
			||||||
| 
						 | 
					@ -104,7 +104,7 @@ export const createEvent = async (credential: Credential, calEvent: CalendarEven
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Check if the disabledNotes flag is set to true
 | 
					  // Check if the disabledNotes flag is set to true
 | 
				
			||||||
  if (calEvent.hideCalendarNotes) {
 | 
					  if (calEvent.hideCalendarNotes) {
 | 
				
			||||||
    calEvent.description = "Notes have been hidden by the organiser"; // TODO: i18n this string?
 | 
					    calEvent.additionalNotes = "Notes have been hidden by the organiser"; // TODO: i18n this string?
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const creationResult = calendar
 | 
					  const creationResult = calendar
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -48,10 +48,15 @@ ${organizer + attendees}
 | 
				
			||||||
export const getAdditionalNotes = (calEvent: CalendarEvent) => {
 | 
					export const getAdditionalNotes = (calEvent: CalendarEvent) => {
 | 
				
			||||||
  return `
 | 
					  return `
 | 
				
			||||||
${calEvent.organizer.language.translate("additional_notes")}:
 | 
					${calEvent.organizer.language.translate("additional_notes")}:
 | 
				
			||||||
${calEvent.description}
 | 
					${calEvent.additionalNotes}
 | 
				
			||||||
  `;
 | 
					  `;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const getDescription = (calEvent: CalendarEvent) => {
 | 
				
			||||||
 | 
					  return `\n${calEvent.attendees[0].language.translate("description")}
 | 
				
			||||||
 | 
					    ${calEvent.description}
 | 
				
			||||||
 | 
					    `;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
export const getLocation = (calEvent: CalendarEvent) => {
 | 
					export const getLocation = (calEvent: CalendarEvent) => {
 | 
				
			||||||
  let providerName = "";
 | 
					  let providerName = "";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -97,6 +102,7 @@ ${getWhen(calEvent)}
 | 
				
			||||||
${getWho(calEvent)}
 | 
					${getWho(calEvent)}
 | 
				
			||||||
${calEvent.organizer.language.translate("where")}:
 | 
					${calEvent.organizer.language.translate("where")}:
 | 
				
			||||||
${getLocation(calEvent)}
 | 
					${getLocation(calEvent)}
 | 
				
			||||||
 | 
					${getDescription(calEvent)}
 | 
				
			||||||
${getAdditionalNotes(calEvent)}
 | 
					${getAdditionalNotes(calEvent)}
 | 
				
			||||||
  `.trim();
 | 
					  `.trim();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					@ -107,6 +113,7 @@ ${getWhen(calEvent)}
 | 
				
			||||||
${getWho(calEvent)}
 | 
					${getWho(calEvent)}
 | 
				
			||||||
${calEvent.organizer.language.translate("where")}:
 | 
					${calEvent.organizer.language.translate("where")}:
 | 
				
			||||||
${getLocation(calEvent)}
 | 
					${getLocation(calEvent)}
 | 
				
			||||||
 | 
					${getDescription(calEvent)}
 | 
				
			||||||
${getAdditionalNotes(calEvent)}
 | 
					${getAdditionalNotes(calEvent)}
 | 
				
			||||||
${getManageLink(calEvent)}
 | 
					${getManageLink(calEvent)}
 | 
				
			||||||
  `.trim();
 | 
					  `.trim();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										1
									
								
								packages/types/Calendar.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								packages/types/Calendar.d.ts
									
									
									
									
										vendored
									
									
								
							| 
						 | 
					@ -75,6 +75,7 @@ export interface CalendarEvent {
 | 
				
			||||||
  title: string;
 | 
					  title: string;
 | 
				
			||||||
  startTime: string;
 | 
					  startTime: string;
 | 
				
			||||||
  endTime: string;
 | 
					  endTime: string;
 | 
				
			||||||
 | 
					  additionalNotes?: string | null;
 | 
				
			||||||
  description?: string | null;
 | 
					  description?: string | null;
 | 
				
			||||||
  team?: {
 | 
					  team?: {
 | 
				
			||||||
    name: string;
 | 
					    name: string;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue