From 97d30200271228a45d67b8c8259235bc63abea78 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Thu, 26 Jan 2017 12:02:27 +0100 Subject: [PATCH] fix shared-as-busy events for owner Signed-off-by: Georg Ehrke --- apps/dav/lib/CalDAV/CalendarObject.php | 8 +++++++- apps/dav/tests/unit/CalDAV/CalendarTest.php | 8 +++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/apps/dav/lib/CalDAV/CalendarObject.php b/apps/dav/lib/CalDAV/CalendarObject.php index 6d429fa6bf5..c5dc50650af 100644 --- a/apps/dav/lib/CalDAV/CalendarObject.php +++ b/apps/dav/lib/CalDAV/CalendarObject.php @@ -1,8 +1,10 @@ + * @author Georg Ehrke * * @license AGPL-3.0 * @@ -42,7 +44,11 @@ class CalendarObject extends \Sabre\CalDAV\CalendarObject { } 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']; } /** diff --git a/apps/dav/tests/unit/CalDAV/CalendarTest.php b/apps/dav/tests/unit/CalDAV/CalendarTest.php index d0fb2d19243..70a072f04de 100644 --- a/apps/dav/tests/unit/CalDAV/CalendarTest.php +++ b/apps/dav/tests/unit/CalDAV/CalendarTest.php @@ -334,17 +334,15 @@ EOD; ->willReturn($calObject1)->with(666, 'event-1'); $calendarInfo = [ + '{http://owncloud.org/ns}owner-principal' => $isShared ? 'user1' : 'user2', 'principaluri' => 'user2', 'id' => 666, 'uri' => 'cal', ]; - - if ($isShared) { - $calendarInfo['{http://owncloud.org/ns}owner-principal'] = 'user1'; - - } $c = new Calendar($backend, $calendarInfo, $this->l10n); + $this->assertEquals(count($c->getChildren()), $expectedChildren); + // test private event $privateEvent = $c->getChild('event-1'); $calData = $privateEvent->get(); -- 2.39.5