Skip to content

Commit

Permalink
Only VEVENT for birthday calendar and default order to 100
Browse files Browse the repository at this point in the history
  • Loading branch information
tomneedham authored and DeepDiver1975 committed May 26, 2017
1 parent c69ebf2 commit afbe709
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion apps/dav/lib/CalDAV/BirthdayService.php
Expand Up @@ -25,6 +25,7 @@
use Exception;
use OCA\DAV\CardDAV\CardDavBackend;
use OCA\DAV\DAV\GroupPrincipalBackend;
use Sabre\CalDAV\Xml\Property\SupportedCalendarComponentSet;
use Sabre\VObject\Component\VCalendar;
use Sabre\VObject\Component\VCard;
use Sabre\VObject\DateTimeParser;
Expand Down Expand Up @@ -106,7 +107,8 @@ public function ensureCalendarExists($principal) {
$this->calDavBackEnd->createCalendar($principal, self::BIRTHDAY_CALENDAR_URI, [
'{DAV:}displayname' => 'Contact birthdays',
'{http://apple.com/ns/ical/}calendar-color' => '#FFFFCA',
'components' => 'VEVENT',
'{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VEVENT']),
'{http://apple.com/ns/ical/}calendar-order' => 100
]);

return $this->calDavBackEnd->getCalendarByUri($principal, self::BIRTHDAY_CALENDAR_URI);
Expand Down
4 changes: 2 additions & 2 deletions apps/dav/lib/CalDAV/CalDavBackend.php
Expand Up @@ -532,7 +532,7 @@ public function getCalendarById($calendarId) {
*
* @param string $principalUri
* @param string $calendarUri
* @param array $properties
* @param array $properties (keys must be CalDAV properties not db names)
* @return int
* @throws DAV\Exception
*/
Expand All @@ -544,7 +544,7 @@ function createCalendar($principalUri, $calendarUri, array $properties) {
'synctoken' => 1,
'transparent' => 0,
'components' => 'VEVENT,VTODO',
'displayname' => $calendarUri
'displayname' => $calendarUri,
];

// Default value
Expand Down
4 changes: 3 additions & 1 deletion apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php
Expand Up @@ -26,6 +26,7 @@
use OCA\DAV\CalDAV\CalDavBackend;
use OCA\DAV\CardDAV\CardDavBackend;
use OCA\DAV\DAV\GroupPrincipalBackend;
use Sabre\CalDAV\Xml\Property\SupportedCalendarComponentSet;
use Sabre\VObject\Component\VCalendar;
use Sabre\VObject\Reader;
use Test\TestCase;
Expand Down Expand Up @@ -199,7 +200,8 @@ public function testBirthdayCalendarHasComponentEvent() {
->with('principal001', 'contact_birthdays', [
'{DAV:}displayname' => 'Contact birthdays',
'{http://apple.com/ns/ical/}calendar-color' => '#FFFFCA',
'components' => 'VEVENT',
'{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VEVENT']),
'{http://apple.com/ns/ical/}calendar-order' => 100
]);
$this->service->ensureCalendarExists('principal001');
}
Expand Down

0 comments on commit afbe709

Please sign in to comment.