Skip to content

Commit

Permalink
Merge pull request #3275 from nextcloud/fix/2787/busy_also_for_creato…
Browse files Browse the repository at this point in the history
…r_bug

fix shared-as-busy events for owner
  • Loading branch information
MorrisJobke authored Jan 26, 2017
2 parents 382e20f + 97d3020 commit 426c8e3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 7 additions & 1 deletion apps/dav/lib/CalDAV/CalendarObject.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?php
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
* @copyright Copyright (c) 2017, Georg Ehrke
*
* @author Thomas Müller <[email protected]>
* @author Georg Ehrke <[email protected]>
*
* @license AGPL-3.0
*
Expand Down Expand Up @@ -42,7 +44,11 @@ function get() {
}

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'];
}

/**
Expand Down
8 changes: 3 additions & 5 deletions apps/dav/tests/unit/CalDAV/CalendarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,17 +334,15 @@ public function testConfidentialClassification($expectedChildren, $isShared) {
->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();
Expand Down

0 comments on commit 426c8e3

Please sign in to comment.