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

fix(dav): fix event birthday alarms not being updated #39977

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tcitworld
Copy link
Member

In #33251 the default offset for a birthday event alarm was changed to 9AM on the day of the event.

However the birthdayEvenChanged method did not account for alarm changes, so it was never propagated to existing birthday events, which were kept on midnight.

Checklist

@tcitworld tcitworld added bug 3. to review Waiting for reviews feature: caldav Related to CalDAV internals feature: carddav Related to CardDAV internals labels Aug 19, 2023
@tcitworld tcitworld added this to the Nextcloud 28 milestone Aug 19, 2023
@tcitworld tcitworld requested a review from a team August 19, 2023 09:47
@tcitworld
Copy link
Member Author

/backport to stable27

@tcitworld
Copy link
Member Author

/backport to stable26

@tcitworld
Copy link
Member Author

/backport to stable25

@@ -331,7 +336,8 @@

return (
$newCalendarData->VEVENT->DTSTART->getValue() !== $existingBirthday->VEVENT->DTSTART->getValue() ||
$newCalendarData->VEVENT->SUMMARY->getValue() !== $existingBirthday->VEVENT->SUMMARY->getValue()
$newCalendarData->VEVENT->SUMMARY->getValue() !== $existingBirthday->VEVENT->SUMMARY->getValue() ||
($newCalendarData->VEVENT->VALARM && $existingBirthday->VEVENT->VALARM && $newCalendarData->VEVENT->VALARM->TRIGGER->getValue() !== $existingBirthday->VEVENT->VALARM->TRIGGER->getValue())

Check failure

Code scanning / Psalm

UndefinedPropertyFetch Error

Instance property Sabre\VObject\Property::$VALARM is not defined
@@ -331,7 +336,8 @@

return (
$newCalendarData->VEVENT->DTSTART->getValue() !== $existingBirthday->VEVENT->DTSTART->getValue() ||
$newCalendarData->VEVENT->SUMMARY->getValue() !== $existingBirthday->VEVENT->SUMMARY->getValue()
$newCalendarData->VEVENT->SUMMARY->getValue() !== $existingBirthday->VEVENT->SUMMARY->getValue() ||
($newCalendarData->VEVENT->VALARM && $existingBirthday->VEVENT->VALARM && $newCalendarData->VEVENT->VALARM->TRIGGER->getValue() !== $existingBirthday->VEVENT->VALARM->TRIGGER->getValue())

Check failure

Code scanning / Psalm

UndefinedPropertyFetch Error

Instance property Sabre\VObject\Property::$VALARM is not defined
@@ -331,7 +336,8 @@

return (
$newCalendarData->VEVENT->DTSTART->getValue() !== $existingBirthday->VEVENT->DTSTART->getValue() ||
$newCalendarData->VEVENT->SUMMARY->getValue() !== $existingBirthday->VEVENT->SUMMARY->getValue()
$newCalendarData->VEVENT->SUMMARY->getValue() !== $existingBirthday->VEVENT->SUMMARY->getValue() ||

Check notice

Code scanning / Psalm

PossiblyNullPropertyFetch Note

Cannot get property on possibly null variable $newCalendarData->VEVENT of type Sabre\VObject\Property|null
@@ -331,7 +336,8 @@

return (
$newCalendarData->VEVENT->DTSTART->getValue() !== $existingBirthday->VEVENT->DTSTART->getValue() ||
$newCalendarData->VEVENT->SUMMARY->getValue() !== $existingBirthday->VEVENT->SUMMARY->getValue()
$newCalendarData->VEVENT->SUMMARY->getValue() !== $existingBirthday->VEVENT->SUMMARY->getValue() ||

Check notice

Code scanning / Psalm

UndefinedPropertyFetch Note

Instance property Sabre\VObject\Property::$SUMMARY is not defined
@@ -331,7 +336,8 @@

return (
$newCalendarData->VEVENT->DTSTART->getValue() !== $existingBirthday->VEVENT->DTSTART->getValue() ||
$newCalendarData->VEVENT->SUMMARY->getValue() !== $existingBirthday->VEVENT->SUMMARY->getValue()
$newCalendarData->VEVENT->SUMMARY->getValue() !== $existingBirthday->VEVENT->SUMMARY->getValue() ||

Check notice

Code scanning / Psalm

PossiblyNullReference Note

Cannot call method getValue on possibly null value
@@ -331,7 +336,8 @@

return (
$newCalendarData->VEVENT->DTSTART->getValue() !== $existingBirthday->VEVENT->DTSTART->getValue() ||
$newCalendarData->VEVENT->SUMMARY->getValue() !== $existingBirthday->VEVENT->SUMMARY->getValue()
$newCalendarData->VEVENT->SUMMARY->getValue() !== $existingBirthday->VEVENT->SUMMARY->getValue() ||

Check notice

Code scanning / Psalm

PossiblyNullPropertyFetch Note

Cannot get property on possibly null variable $existingBirthday->VEVENT of type Sabre\VObject\Property|null
@@ -331,7 +336,8 @@

return (
$newCalendarData->VEVENT->DTSTART->getValue() !== $existingBirthday->VEVENT->DTSTART->getValue() ||
$newCalendarData->VEVENT->SUMMARY->getValue() !== $existingBirthday->VEVENT->SUMMARY->getValue()
$newCalendarData->VEVENT->SUMMARY->getValue() !== $existingBirthday->VEVENT->SUMMARY->getValue() ||

Check notice

Code scanning / Psalm

UndefinedPropertyFetch Note

Instance property Sabre\VObject\Property::$SUMMARY is not defined
@@ -331,7 +336,8 @@

return (
$newCalendarData->VEVENT->DTSTART->getValue() !== $existingBirthday->VEVENT->DTSTART->getValue() ||
$newCalendarData->VEVENT->SUMMARY->getValue() !== $existingBirthday->VEVENT->SUMMARY->getValue()
$newCalendarData->VEVENT->SUMMARY->getValue() !== $existingBirthday->VEVENT->SUMMARY->getValue() ||

Check notice

Code scanning / Psalm

PossiblyNullReference Note

Cannot call method getValue on possibly null value
@@ -331,7 +336,8 @@

return (
$newCalendarData->VEVENT->DTSTART->getValue() !== $existingBirthday->VEVENT->DTSTART->getValue() ||
$newCalendarData->VEVENT->SUMMARY->getValue() !== $existingBirthday->VEVENT->SUMMARY->getValue()
$newCalendarData->VEVENT->SUMMARY->getValue() !== $existingBirthday->VEVENT->SUMMARY->getValue() ||
($newCalendarData->VEVENT->VALARM && $existingBirthday->VEVENT->VALARM && $newCalendarData->VEVENT->VALARM->TRIGGER->getValue() !== $existingBirthday->VEVENT->VALARM->TRIGGER->getValue())

Check notice

Code scanning / Psalm

PossiblyNullPropertyFetch Note

Cannot get property on possibly null variable $newCalendarData->VEVENT of type Sabre\VObject\Property|null
@@ -331,7 +336,8 @@

return (
$newCalendarData->VEVENT->DTSTART->getValue() !== $existingBirthday->VEVENT->DTSTART->getValue() ||
$newCalendarData->VEVENT->SUMMARY->getValue() !== $existingBirthday->VEVENT->SUMMARY->getValue()
$newCalendarData->VEVENT->SUMMARY->getValue() !== $existingBirthday->VEVENT->SUMMARY->getValue() ||
($newCalendarData->VEVENT->VALARM && $existingBirthday->VEVENT->VALARM && $newCalendarData->VEVENT->VALARM->TRIGGER->getValue() !== $existingBirthday->VEVENT->VALARM->TRIGGER->getValue())

Check notice

Code scanning / Psalm

PossiblyNullPropertyFetch Note

Cannot get property on possibly null variable $existingBirthday->VEVENT of type Sabre\VObject\Property|null
Copy link
Contributor

@nfebe nfebe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@miaulalala miaulalala force-pushed the dav-fix-birthday-sync branch from 03a300c to f3ccb5d Compare August 28, 2023 10:35
@tcitworld tcitworld force-pushed the dav-fix-birthday-sync branch from f3ccb5d to 24e6ef5 Compare October 2, 2023 09:33
@tcitworld
Copy link
Member Author

Should we add a repair job just like RegenerateBirthdayCalendars to fix all existing events? Or just edit the app config value from regeneratedBirthdayCalendarsForYearFix to something like regeneratedBirthdayCalendarsForAlarmFix so that it's triggered again?

@miaulalala
Copy link
Contributor

Should we add a repair job just like RegenerateBirthdayCalendars to fix all existing events? Or just edit the app config value from regeneratedBirthdayCalendarsForYearFix to something like regeneratedBirthdayCalendarsForAlarmFix so that it's triggered again?

Repair step sounds good to me.

@tcitworld tcitworld force-pushed the dav-fix-birthday-sync branch 2 times, most recently from 3ba9335 to c2c2c8b Compare October 2, 2023 15:12
@blizzz blizzz force-pushed the dav-fix-birthday-sync branch from c2c2c8b to 87c8581 Compare October 11, 2023 13:33
@skjnldsv skjnldsv mentioned this pull request Nov 1, 2023
This was referenced Nov 6, 2023
This was referenced Nov 14, 2023
@blizzz blizzz modified the milestones: Nextcloud 28, Nextcloud 29 Nov 23, 2023
In #33251 the default offset for
a birthday event alarm was changed to 9AM on the day of the event.

However the birthdayEvenChanged method did not account for alarm
changes, so it was never propagated to existing birthday events, which
were kept on midnight.

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
…thday calendars

So that birthday calendars are immediately updated and we don't need to wait for user to change a
card or disable/enable the calendar. We reuse the existing RegenerateBirthdayCalendars repair step
instead of adding a new one.

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
@tcitworld tcitworld force-pushed the dav-fix-birthday-sync branch from 87c8581 to 4451809 Compare February 1, 2024 17:29
@tcitworld
Copy link
Member Author

Rebased

@tcitworld
Copy link
Member Author

/backport to stable28

// only run once
if ($this->config->getAppValue('dav', 'regeneratedBirthdayCalendarsForYearFix') === 'yes') {
if ($this->config->getAppValue('dav', 'regeneratedBirthdayCalendarsForYearFix') === 'yes' && $this->config->getAppValue('dav', 'regeneratedBirthdayCalendarsForAlarmFix') === 'yes') {

Check notice

Code scanning / Psalm

DeprecatedMethod Note

The method OCP\IConfig::getAppValue has been marked as deprecated
// only run once
if ($this->config->getAppValue('dav', 'regeneratedBirthdayCalendarsForYearFix') === 'yes') {
if ($this->config->getAppValue('dav', 'regeneratedBirthdayCalendarsForYearFix') === 'yes' && $this->config->getAppValue('dav', 'regeneratedBirthdayCalendarsForAlarmFix') === 'yes') {

Check notice

Code scanning / Psalm

DeprecatedMethod Note

The method OCP\IConfig::getAppValue has been marked as deprecated
@@ -69,5 +56,6 @@

// if all were done, no need to redo the repair during next upgrade
$this->config->setAppValue('dav', 'regeneratedBirthdayCalendarsForYearFix', 'yes');
$this->config->setAppValue('dav', 'regeneratedBirthdayCalendarsForAlarmFix', 'yes');

Check notice

Code scanning / Psalm

DeprecatedMethod Note

The method OCP\IConfig::setAppValue has been marked as deprecated
@skjnldsv
Copy link
Member

psalm says
No Way Snl GIF

@skjnldsv skjnldsv added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Feb 23, 2024
This was referenced Mar 12, 2024
This was referenced Mar 20, 2024
@skjnldsv skjnldsv mentioned this pull request Mar 28, 2024
81 tasks
@skjnldsv skjnldsv modified the milestones: Nextcloud 29, Nextcloud 30 Mar 28, 2024
This was referenced Jul 30, 2024
This was referenced Aug 5, 2024
@skjnldsv skjnldsv mentioned this pull request Aug 13, 2024
@skjnldsv skjnldsv removed this from the Nextcloud 30 milestone Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2. developing Work in progress backport-request bug feature: caldav Related to CalDAV internals feature: carddav Related to CardDAV internals
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants