[DAV][CalDAV] Fixes

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2017-07-20 09:36:18 +02:00
parent 201bbb962c
commit f57a3aa81b
No known key found for this signature in database
GPG key ID: F941078878347C0C
5 changed files with 15 additions and 14 deletions

View file

@ -168,32 +168,32 @@ class Calendar extends Base {
case self::SUBJECT_UNSHARE_USER . '_self':
return [
'actor' => $this->generateUserParameter($parameters[0]),
'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]),
'calendar' => $this->generateCalendarParameter((int)$event->getObjectId(), $parameters[1]),
];
case self::SUBJECT_SHARE_USER . '_you':
case self::SUBJECT_UNSHARE_USER . '_you':
return [
'user' => $this->generateUserParameter($parameters[0]),
'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]),
'calendar' => $this->generateCalendarParameter((int)$event->getObjectId(), $parameters[1]),
];
case self::SUBJECT_SHARE_USER . '_by':
case self::SUBJECT_UNSHARE_USER . '_by':
return [
'user' => $this->generateUserParameter($parameters[0]),
'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]),
'calendar' => $this->generateCalendarParameter((int)$event->getObjectId(), $parameters[1]),
'actor' => $this->generateUserParameter($parameters[2]),
];
case self::SUBJECT_SHARE_GROUP . '_you':
case self::SUBJECT_UNSHARE_GROUP . '_you':
return [
'group' => $this->generateGroupParameter($parameters[0]),
'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]),
'calendar' => $this->generateCalendarParameter((int)$event->getObjectId(), $parameters[1]),
];
case self::SUBJECT_SHARE_GROUP . '_by':
case self::SUBJECT_UNSHARE_GROUP . '_by':
return [
'group' => $this->generateGroupParameter($parameters[0]),
'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]),
'calendar' => $this->generateCalendarParameter((int)$event->getObjectId(), $parameters[1]),
'actor' => $this->generateUserParameter($parameters[2]),
];
}

View file

@ -124,14 +124,14 @@ class Event extends Base {
case self::SUBJECT_OBJECT_UPDATE . '_event':
return [
'actor' => $this->generateUserParameter($parameters[0]),
'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]),
'calendar' => $this->generateCalendarParameter((int)$event->getObjectId(), $parameters[1]),
'event' => $this->generateObjectParameter($parameters[2]),
];
case self::SUBJECT_OBJECT_ADD . '_event_self':
case self::SUBJECT_OBJECT_DELETE . '_event_self':
case self::SUBJECT_OBJECT_UPDATE . '_event_self':
return [
'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]),
'calendar' => $this->generateCalendarParameter((int)$event->getObjectId(), $parameters[1]),
'event' => $this->generateObjectParameter($parameters[2]),
];
}

View file

@ -95,7 +95,7 @@ class Todo extends Event {
case self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action':
return [
'actor' => $this->generateUserParameter($parameters[0]),
'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]),
'calendar' => $this->generateCalendarParameter((int)$event->getObjectId(), $parameters[1]),
'todo' => $this->generateObjectParameter($parameters[2]),
];
case self::SUBJECT_OBJECT_ADD . '_todo_self':
@ -104,7 +104,7 @@ class Todo extends Event {
case self::SUBJECT_OBJECT_UPDATE . '_todo_completed_self':
case self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action_self':
return [
'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]),
'calendar' => $this->generateCalendarParameter((int)$event->getObjectId(), $parameters[1]),
'todo' => $this->generateObjectParameter($parameters[2]),
];
}

View file

@ -270,7 +270,7 @@ class BirthdayService {
* @param string $cardData
* @param array $book
* @param int $calendarId
* @param string $type
* @param string[] $type
*/
private function updateCalendar($cardUri, $cardData, $book, $calendarId, $type) {
$objectUri = $book['uri'] . '-' . $cardUri . $type['postfix'] . '.ics';

View file

@ -50,6 +50,7 @@ use Sabre\VObject\Component\VCalendar;
use Sabre\VObject\DateTimeParser;
use Sabre\VObject\Reader;
use Sabre\VObject\Recur\EventIterator;
use Sabre\Uri;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
@ -318,7 +319,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
}
}
list(, $name) = URLUtil::splitPath($row['principaluri']);
list(, $name) = Uri\split($row['principaluri']);
$uri = $row['uri'] . '_shared_by_' . $name;
$row['displayname'] = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')';
$components = [];
@ -432,7 +433,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
->execute();
while($row = $result->fetch()) {
list(, $name) = URLUtil::splitPath($row['principaluri']);
list(, $name) = Uri\split($row['principaluri']);
$row['displayname'] = $row['displayname'] . "($name)";
$components = [];
if ($row['components']) {
@ -498,7 +499,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
throw new NotFound('Node with name \'' . $uri . '\' could not be found');
}
list(, $name) = URLUtil::splitPath($row['principaluri']);
list(, $name) = Uri\split($row['principaluri']);
$row['displayname'] = $row['displayname'] . ' ' . "($name)";
$components = [];
if ($row['components']) {
@ -2104,7 +2105,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
private function convertPrincipal($principalUri, $toV2) {
if ($this->principalBackend->getPrincipalPrefix() === 'principals') {
list(, $name) = URLUtil::splitPath($principalUri);
list(, $name) = Uri\split($principalUri);
if ($toV2 === true) {
return "principals/users/$name";
}