Skip to content

Commit

Permalink
Merge pull request #8679 from nextcloud/7707_12
Browse files Browse the repository at this point in the history
[stable12] generate different UIDs for Birthday, Anniversary and Death event
  • Loading branch information
MorrisJobke authored Mar 6, 2018
2 parents 95f067a + 8b28e91 commit 6acc307
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions apps/dav/lib/CalDAV/BirthdayService.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,11 @@ public function ensureCalendarExists($principal) {
/**
* @param string $cardData
* @param string $dateField
* @param string $postfix
* @param string $summarySymbol
* @return null|VCalendar
*/
public function buildDateFromContact($cardData, $dateField, $summarySymbol) {
public function buildDateFromContact($cardData, $dateField, $postfix, $summarySymbol) {
if (empty($cardData)) {
return null;
}
Expand Down Expand Up @@ -198,7 +199,7 @@ public function buildDateFromContact($cardData, $dateField, $summarySymbol) {
$date
);
$vEvent->DTEND['VALUE'] = 'DATE';
$vEvent->{'UID'} = $doc->UID;
$vEvent->{'UID'} = $doc->UID . $postfix;
$vEvent->{'RRULE'} = 'FREQ=YEARLY';
$vEvent->{'SUMMARY'} = $summary;
$vEvent->{'TRANSP'} = 'TRANSPARENT';
Expand Down Expand Up @@ -274,7 +275,7 @@ protected function getAllAffectedPrincipals($addressBookId) {
*/
private function updateCalendar($cardUri, $cardData, $book, $calendarId, $type) {
$objectUri = $book['uri'] . '-' . $cardUri . $type['postfix'] . '.ics';
$calendarData = $this->buildDateFromContact($cardData, $type['field'], $type['symbol']);
$calendarData = $this->buildDateFromContact($cardData, $type['field'], $type['postfix'], $type['symbol']);
$existing = $this->calDavBackEnd->getCalendarObject($calendarId, $objectUri);
if (is_null($calendarData)) {
if (!is_null($existing)) {
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function setUp() {
* @param string | null $data
*/
public function testBuildBirthdayFromContact($expectedSummary, $data) {
$cal = $this->service->buildDateFromContact($data, 'BDAY', '*');
$cal = $this->service->buildDateFromContact($data, 'BDAY', '', '*');
if ($expectedSummary === null) {
$this->assertNull($cal);
} else {
Expand Down

0 comments on commit 6acc307

Please sign in to comment.