Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(caldav): Add sharee to address list when calendar is shared #45054

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion apps/dav/lib/CalDAV/Schedule/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,42 @@ public function calendarObjectChange(RequestInterface $request, ResponseInterfac
}

try {
parent::calendarObjectChange($request, $response, $vCal, $calendarPath, $modified, $isNew);

if (!$this->scheduleReply($this->server->httpRequest)) {
return;
}

/** @var \OCA\DAV\CalDAV\Calendar $calendarNode */
$calendarNode = $this->server->tree->getNodeForPath($calendarPath);
// extract addresses for owner
$addresses = $this->getAddressesForPrincipal($calendarNode->getOwner());
Fixed Show fixed Hide fixed
Fixed Show fixed Hide fixed
Dismissed Show dismissed Hide dismissed
// determain if request is from a sharee
if ($calendarNode->isShared()) {
Fixed Show fixed Hide fixed
// extract addresses for sharee and add to address collection
$addresses = array_merge(
$addresses,
$this->getAddressesForPrincipal($calendarNode->getPrincipalURI())
Fixed Show fixed Hide fixed
);
}
// determine if we are updating a calendar event
if (!$isNew) {
// retrieve current calendar event node
/** @var \OCA\DAV\CalDAV\CalendarObject $currentNode */
$currentNode = $this->server->tree->getNodeForPath($request->getPath());
// convert calendar event string data to VCalendar object
/** @var \Sabre\VObject\Component\VCalendar $currentObject */
$currentObject = Reader::read($currentNode->get());
Fixed Show fixed Hide fixed
Fixed Show fixed Hide fixed
} else {
$currentObject = null;
}
// process request
$this->processICalendarChange($currentObject, $vCal, $addresses, [], $modified);
Fixed Show fixed Hide fixed

if ($currentObject) {
// Destroy circular references so PHP will GC the object.
$currentObject->destroy();
Fixed Show fixed Hide fixed
}

} catch (SameOrganizerForAllComponentsException $e) {
$this->handleSameOrganizerException($e, $vCal, $calendarPath);
}
Expand Down Expand Up @@ -526,7 +561,9 @@ private function isAvailableAtTime(string $email, \DateTimeInterface $start, \Da
$calendarTimeZone = new DateTimeZone('UTC');

$homePath = $result[0][200]['{' . self::NS_CALDAV . '}calendar-home-set']->getHref();
/** @var \OCA\DAV\CalDAV\Calendar $node */
foreach ($this->server->tree->getNodeForPath($homePath)->getChildren() as $node) {

if (!$node instanceof ICalendar) {
continue;
}
Expand Down
Loading
Loading