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/caldav/eventcomparisionservice uses wrong array comparison #44017

Conversation

rcwschaller
Copy link
Contributor

Summary

Fixes the comparison of two arrays that contain relevant differences between two events.

Old comparison implementation compares each element of the array against each other with no respect for the associated array label, which leads to wrongful removals because one value is accidentally present in a completely different label. New comparison works 'by-label' individually.
Refer to php manual https://www.php.net/manual/en/function.array-diff.php

Partly fixes #41084 because changes between 'SEQUENCE' not present, 'SEQUENCE:0' and 'SEQUENCE:1' were not detected in the old implementation and thus no email update sent.

@miaulalala please inspect. Small fix for your otherwise comprehensive contribution for nextcloud/calendar#3919

TODO

#41084 needs to remain open as there is a second issue, which prevents the SEQUENCE evaluation in certain cases.

/backport to stable28
/backport to stable27
/backport to stable26

@ChristophWurst ChristophWurst added bug 3. to review Waiting for reviews feature: dav feature: caldav Related to CalDAV internals labels Mar 6, 2024
@tcitworld
Copy link
Member

Do you mind adding a test to EventComparisonServiceTest that demonstrates this behavior is fixed?

@rcwschaller
Copy link
Contributor Author

Do you mind adding a test to EventComparisonServiceTest that demonstrates this behavior is fixed?

Done. Not really sure if such a small change warrants the tests, but if it helps the collaboration, I am happy to provide it.

Copy link
Member

@tcitworld tcitworld left a comment

Choose a reason for hiding this comment

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

Thanks for the effort, appreciated.

Do you mind fixing the lint issues reported by the CI? The other failures are unrelated. We can take care of that if you prefer.

@miaulalala
Copy link
Contributor

Can you squash all your commits into one?

Easiest is probably:

git reset --soft master
git add <your files>
git commit -sm "... your commit message here..."
git push --force-with-lease

@rcwschaller rcwschaller force-pushed the fix/caldav/eventcomparisionservice-uses-wrong-array-comparison branch 2 times, most recently from 8998801 to ebc3925 Compare March 25, 2024 01:20
@rcwschaller
Copy link
Contributor Author

@miaulalala should be clean now.

Old comparison implementation compares each element of the array against each other with no respect for the associated array label, which leads to wrongful removals because one value is accidentally present in a completely different label. New comparison works 'by-label' individually.

Partly fixes nextcloud#41084 because changes between 'SEQUENCE' not present, 'SEQUENCE:0' and 'SEQUENCE:1' were not detected in the old implementation and thus no email update sent.

Co-authored-by: Christoph Wurst <ChristophWurst@users.noreply.github.com>
Signed-off-by: Robert C. Schaller <gtbc_robert.schaller@rsxc.de>
@miaulalala miaulalala force-pushed the fix/caldav/eventcomparisionservice-uses-wrong-array-comparison branch from ebc3925 to fa6e613 Compare March 25, 2024 12:19
@skjnldsv skjnldsv merged commit 47ac907 into nextcloud:master Mar 26, 2024
159 of 166 checks passed
Copy link

welcome bot commented Mar 26, 2024

Thanks for your first pull request and welcome to the community! Feel free to keep them coming! If you are looking for issues to tackle then have a look at this selection: https://github.com/nextcloud/server/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22

@skjnldsv skjnldsv added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Mar 26, 2024
@rcwschaller
Copy link
Contributor Author

/backport to stable26

@rcwschaller
Copy link
Contributor Author

/backport to stable27

@rcwschaller
Copy link
Contributor Author

/backport to stable28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready to be released and/or waiting for tests to finish bug feature: caldav Related to CalDAV internals feature: dav
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: No calendar event email/notification when event content is updated
6 participants