diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2019-07-27 12:23:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-27 12:23:25 +0200 |
commit | 1ec98af3e028f5aa8591bda26d5dac96dfd66f43 (patch) | |
tree | 869ddaf5d8db845cac96721cfe7523e8fe42d180 | |
parent | 9ef23e236264ba1208c73512f79cc9540a5bb9e1 (diff) | |
parent | 6a2a5465cfbe9d79e83414212d2eb6753fb19480 (diff) | |
download | nextcloud-server-1ec98af3e028f5aa8591bda26d5dac96dfd66f43.tar.gz nextcloud-server-1ec98af3e028f5aa8591bda26d5dac96dfd66f43.zip |
Merge pull request #16560 from nextcloud/bugfix/noid/fix_cutype_reporting
fix calendar-user-type reporting
-rw-r--r-- | apps/dav/lib/CalDAV/Schedule/Plugin.php | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/apps/dav/lib/CalDAV/Schedule/Plugin.php b/apps/dav/lib/CalDAV/Schedule/Plugin.php index 1b262efd4f5..afdd473aee8 100644 --- a/apps/dav/lib/CalDAV/Schedule/Plugin.php +++ b/apps/dav/lib/CalDAV/Schedule/Plugin.php @@ -27,6 +27,7 @@ namespace OCA\DAV\CalDAV\Schedule; use OCA\DAV\CalDAV\CalDavBackend; use OCA\DAV\CalDAV\CalendarHome; use Sabre\DAV\INode; +use Sabre\DAV\IProperties; use Sabre\DAV\PropFind; use Sabre\DAV\Server; use Sabre\DAV\Xml\Property\LocalHref; @@ -55,19 +56,23 @@ class Plugin extends \Sabre\CalDAV\Schedule\Plugin { * @return void */ function propFind(PropFind $propFind, INode $node) { - // overwrite Sabre/Dav's implementation - $propFind->handle('{' . self::NS_CALDAV . '}calendar-user-type', function() use ($node) { - $calendarUserType = '{' . self::NS_CALDAV . '}calendar-user-type'; - $props = $node->getProperties([$calendarUserType]); - - if (isset($props[$calendarUserType])) { - return $props[$calendarUserType]; - } + parent::propFind($propFind, $node); - return 'INDIVIDUAL'; - }); + if ($node instanceof IPrincipal) { + // overwrite Sabre/Dav's implementation + $propFind->handle('{' . self::NS_CALDAV . '}calendar-user-type', function () use ($node) { + if ($node instanceof IProperties) { + $calendarUserType = '{' . self::NS_CALDAV . '}calendar-user-type'; + $props = $node->getProperties([$calendarUserType]); + + if (isset($props[$calendarUserType])) { + return $props[$calendarUserType]; + } + } - parent::propFind($propFind, $node); + return 'INDIVIDUAL'; + }); + } } /** |