Broker::parseEvent not recognizing organizer (mailto vs principal uri) => no invites sent
DoobleD opened this issue · comments
I create events from the OneCalendar Android app with attendees, and invites are not sent. The app sends the following payload:
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Codespark//OneCalendar//EN
BEGIN:VEVENT
UID:db6543f8-fa8c-4552-9d60-4ccf83adf110
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION:mailt
o:john.doe@gmail.com
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION:mailt
o:john.doe@domain.com
DESCRIPTION:Invitation envoy\xC3\xA9e avec OneCalendar. Pour en savoir plus\x5C, visi
tez http://www.onecalendar.nl.
DTSTART;TZID=Europe/Paris:20211028T120000
DTEND;TZID=Europe/Paris:20211028T130000
DTSTAMP:20211018T102616Z
LAST-MODIFIED:20211018T102616Z
LOCATION:
ORGANIZER:mailto:orga@domain.com
SEQUENCE:1
SUMMARY:Log
BEGIN:VALARM
ACTION:DISPLAY
DESCRIPTION:Reminder
TRIGGER;VALUE=DURATION:-PT15M
END:VALARM
END:VEVENT
END:VCALENDAR
The attendee john.doe@domain.com is a user registered on the server with a principal URL, but the attendee john.doe@gmail.com isn't (no principal URL). The organizer orga@domain.com exists of course and has a principal URL.
I'm not really familiar with Sabre's codebase, but the issue seems to be here in Broker::parseEvent
:
if (in_array($eventInfo['organizer'], $userHref)) {
return $this->parseEventForOrganizer($baseCalendar, $eventInfo, $oldEventInfo);
}
When I display the values of $eventInfo['organizer']
and $userHref
I respectively get:
"mailto:orga@domain.com"
["/dav/principals/orga@domain.com"]
Thus the condition doesn't match, and parseEventForOrganizer
is not called. Instead parseEvent
just returns an empty array, preventing the caller (Schedule::calendarObjectChange
) from sending any invites.
This can be fixed by using a custom class inheriting Schedule
and overloading Schedule::getAddressesForPrincipal
to add "mailto:orga@domain.com" in the addresses the function returns. But I feel like this is a bad hack and something else is wrong. Also even with that fix, invites are sent only to users with a principal URL existing on the server, external attendees don't get anything and the endpoint return a 404 saying these have no principal URL.
Is there something I missed to have this work out of the box without this strange hack? Some required setting?
This mix of dav URLs and mailto in CAL-ADDRESSes is also at the root of another issue I opened. I wouldn't be surprised if I missed something that would make everything work as intended. I supposed both forms of CAL-ADDRESSes should work fine with Sabre.
After rewriting my principals backend the error is gone! That didn't solve #1358 though.