]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix shared-as-busy events for owner 3275/head
authorGeorg Ehrke <developer@georgehrke.com>
Thu, 26 Jan 2017 11:02:27 +0000 (12:02 +0100)
committerGeorg Ehrke <developer@georgehrke.com>
Thu, 26 Jan 2017 11:06:07 +0000 (12:06 +0100)
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
apps/dav/lib/CalDAV/CalendarObject.php
apps/dav/tests/unit/CalDAV/CalendarTest.php

index 6d429fa6bf5b61527d6f043f7f974a775d0fbb85..c5dc50650aff666fd9c719776fe62f7c7b151f5d 100644 (file)
@@ -1,8 +1,10 @@
 <?php
 /**
  * @copyright Copyright (c) 2016, ownCloud, Inc.
+ * @copyright Copyright (c) 2017, Georg Ehrke
  *
  * @author Thomas Müller <thomas.mueller@tmit.eu>
+ * @author Georg Ehrke <oc.list@georgehrke.com>
  *
  * @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'];
        }
 
        /**
index d0fb2d1924350e5d313d05febb479b6993415c07..70a072f04dedf56582868ff8943fb5f474017037 100644 (file)
@@ -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();