Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable13] generate different UIDs for Birthday, Anniversary and Death event #8678

Merged
merged 1 commit into from Mar 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions apps/dav/lib/CalDAV/BirthdayService.php
Expand Up @@ -148,10 +148,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 @@ -221,7 +222,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 @@ -297,7 +298,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
Expand Up @@ -64,7 +64,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