fix shared-as-busy events for owner

Signed-off-by: Georg Ehrke <developer@georgehrke.com>
This commit is contained in:
Georg Ehrke 2017-01-26 12:02:27 +01:00
parent 3a603ab8b4
commit 97d3020027
No known key found for this signature in database
GPG Key ID: 9D98FD9380A1CB43
2 changed files with 10 additions and 6 deletions

View File

@ -1,8 +1,10 @@
<?php <?php
/** /**
* @copyright Copyright (c) 2016, ownCloud, Inc. * @copyright Copyright (c) 2016, ownCloud, Inc.
* @copyright Copyright (c) 2017, Georg Ehrke
* *
* @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Müller <thomas.mueller@tmit.eu>
* @author Georg Ehrke <oc.list@georgehrke.com>
* *
* @license AGPL-3.0 * @license AGPL-3.0
* *
@ -42,7 +44,11 @@ class CalendarObject extends \Sabre\CalDAV\CalendarObject {
} }
private function isShared() { private function isShared() {
return isset($this->calendarInfo['{http://owncloud.org/ns}owner-principal']); if (!isset($this->calendarInfo['{http://owncloud.org/ns}owner-principal'])) {
return false;
}
return $this->calendarInfo['{http://owncloud.org/ns}owner-principal'] !== $this->calendarInfo['principaluri'];
} }
/** /**

View File

@ -334,17 +334,15 @@ EOD;
->willReturn($calObject1)->with(666, 'event-1'); ->willReturn($calObject1)->with(666, 'event-1');
$calendarInfo = [ $calendarInfo = [
'{http://owncloud.org/ns}owner-principal' => $isShared ? 'user1' : 'user2',
'principaluri' => 'user2', 'principaluri' => 'user2',
'id' => 666, 'id' => 666,
'uri' => 'cal', 'uri' => 'cal',
]; ];
if ($isShared) {
$calendarInfo['{http://owncloud.org/ns}owner-principal'] = 'user1';
}
$c = new Calendar($backend, $calendarInfo, $this->l10n); $c = new Calendar($backend, $calendarInfo, $this->l10n);
$this->assertEquals(count($c->getChildren()), $expectedChildren);
// test private event // test private event
$privateEvent = $c->getChild('event-1'); $privateEvent = $c->getChild('event-1');
$calData = $privateEvent->get(); $calData = $privateEvent->get();