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

[Bug]: Wrong relative time for events in caldav push notifications #41615

Closed
4 of 8 tasks
ChristophWurst opened this issue Nov 20, 2023 · 12 comments · Fixed by #41722
Closed
4 of 8 tasks

[Bug]: Wrong relative time for events in caldav push notifications #41615

ChristophWurst opened this issue Nov 20, 2023 · 12 comments · Fixed by #41722
Assignees
Labels
Milestone

Comments

@ChristophWurst
Copy link
Member

⚠️ This issue respects the following points: ⚠️

Bug description

Since #39862 Nextcloud shows push notifications for events. They do not handle recurrence, so an event always shows relative to the first instance, not the next instance. E.g -1 years

Steps to reproduce

  1. Enable notifications app
  2. Create a recurring event
  3. Have cron running
  4. Have an open web session or a connected device

Expected behavior

Notifications shows with correct relative time

Installation method

None

Nextcloud Server version

28

Operating system

None

PHP engine version

None

Web server

None

Database engine version

None

Is this bug present after an update or on a fresh install?

None

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

No response

List of activated Apps

No response

Nextcloud Signing status

No response

Nextcloud Logs

No response

Additional info

No response

@GretaD
Copy link
Contributor

GretaD commented Nov 21, 2023

comment from hamza:

\OCA\DAV\CalDAV\Reminder\ReminderService::getVEventByRecurrenceId

I think this method is probably where the problem originates

because it joins the event data from oc_calendar_objects with the oc_calendar_reminder data in \OCA\DAV\CalDAV\Reminder\Backend::getRemindersToProcess which does not do a proper recurrence expansion like the search does if I see that correctly.

apps/dav/lib/CalDAV/CalDavBackend.php:1962 onwards does the expansion for the search

@ChristophWurst
Copy link
Member Author

Observation shows that is is always -1 years, 11months. So it's probably not relative to the first instance of a recurring event but some kind of static value.

@ChristophWurst ChristophWurst added 2. developing Work in progress and removed 1. to develop Accepted and waiting to be taken care of labels Nov 22, 2023
@ChristophWurst
Copy link
Member Author

Played with it locally. Events recurring daily and weekly do not cause the bug here. I must be missing something.

SELECT * FROM oc_notifications WHERE user = 'admin' AND app = 'dav' AND subject = 'calendar_reminder'

could help debug the raw data written for notifications

@ChristophWurst
Copy link
Member Author

image

From an affected instance. It doesn't matter if the event happens once, daily or weekly

@ChristophWurst ChristophWurst self-assigned this Nov 22, 2023
@ChristophWurst ChristophWurst changed the title [Bug]: Wrong relative time for recurring events in caldav push notifications [Bug]: Wrong relative time for events in caldav push notifications Nov 22, 2023
@ChristophWurst
Copy link
Member Author

Data looks fine

{
  "title": "Weekly",
  "description": null,
  "location": null,
  "all_day": false,
  "start_atom": "2023-11-22T17:30:00+01:00",
  "start_is_floating": false,
  "start_timezone": "Europe/Vienna",
  "end_atom": "2023-11-22T17:45:00+01:00",
  "end_is_floating": false,
  "end_timezone": "Europe/Vienna",
  "calendar_displayname": "Personal"
}

@ChristophWurst
Copy link
Member Author

It looks very similar to php/php-src#9699

@ChristophWurst
Copy link
Member Author

@ChristophWurst
Copy link
Member Author

https://3v4l.org/IQnhj for a combined view

@ChristophWurst
Copy link
Member Author

@AndyScherzinger @jancborchardt what do you suggest for a workaround if more instances on Ubuntu LTS run into this?

Doing date diffing ourself would be a lot of work. As an alternative we could check if the years difference is <0 and then just hide the relative time.

@SystemKeeper
Copy link
Contributor

Could we use the test cases posted above to detect if a faulty PHP version is used and decide with this if we can use relative time or not?

@ChristophWurst
Copy link
Member Author

Good idea!

@AndyScherzinger
Copy link
Member

Doing date diffing ourself would be a lot of work.

I agree

As an alternative we could check if the years difference is <0 and then just hide the relative time.

Sounds good to me

Could we use the test cases posted above to detect if a faulty PHP version is used and decide with this if we can use relative time or not?

Also I also like this one as a way to deal with it

@ChristophWurst ChristophWurst removed the 2. developing Work in progress label Nov 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging a pull request may close this issue.

6 participants