Skip to content

Commit

Permalink
fix: Mails are sent to the organizer twice
Browse files Browse the repository at this point in the history
The `ics` package doesn't support setting the `SCHEDULE-AGENT`
parameter, there is a PR (adamgibbons/ics#248),
but it is not merged.

This is a workaround that relies on the fact that the `ics` package does
not properly escape the `name` field of the organizer. In a perfect
world, they would merge the PR and create a new release, but this is
unfortunately not the world we live in.

refs calcom#9485
  • Loading branch information
dasJ committed Oct 9, 2023
1 parent d8f6400 commit 7ea72b8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/lib/CalendarService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ export default abstract class BaseCalendarService implements Calendar {
title: event.title,
description: getRichDescription(event),
location: getLocation(event),
organizer: { email: event.organizer.email, name: event.organizer.name },
// TODO Use `name`, `email`, and `scheduleAgent` once https://github.com/adamgibbons/ics/pull/248 is merged
organizer: { name: event.organizer.name + ":MAILTO:" + event.organizer.email + ":SCHEDULE-AGENT=CLIENT" },
attendees: this.getAttendees(event),
/** according to https://datatracker.ietf.org/doc/html/rfc2446#section-3.2.1, in a published iCalendar component.
* "Attendees" MUST NOT be present
Expand Down Expand Up @@ -228,7 +229,8 @@ export default abstract class BaseCalendarService implements Calendar {
title: event.title,
description: getRichDescription(event),
location: getLocation(event),
organizer: { email: event.organizer.email, name: event.organizer.name },
// TODO Use `name`, `email`, and `scheduleAgent` once https://github.com/adamgibbons/ics/pull/248 is merged
organizer: { name: event.organizer.name + ":MAILTO:" + event.organizer.email + ":SCHEDULE-AGENT=CLIENT" },
attendees: this.getAttendees(event),
});

Expand Down

0 comments on commit 7ea72b8

Please sign in to comment.