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

Shared calendar invitations #36756

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

rotdrop
Copy link
Contributor

@rotdrop rotdrop commented Feb 16, 2023

Oh, wait a bit: this is just a study to sort things out. Hence the "Draft" attribute.

Disclaimer: this is not the answer to all problems and not "the solution". It's just a bit of code in order to test the scenario.

Summary

As indicated in the linked issue, support for writeable shared calendars is currently sub-optimal in several respects:

TODO

  • tests, discussions, make it really work, whatever you like

Checklist

I do not care ATM. This pull request is currently only "for the record" in order to support the discussions in #26668 with a little bit more than more than just words.

Explanations

As discussed in the linked issue #26668 invitations for events created in shared (then obviously writeable) calendars are not send.

There was an attempt in commit a9c313c which was then reverted in commit 98a93d5. The reasons for reverting were a couple of loose ends and the fact that a9c313c was incomplete: it only initiated the notifications to be send to the participants but did not address the problem that the underlying Sabre Dav library was not able to process the feedback (accept, deny, maybe) of the invited parties.

This pull request is then kind of a study: can we do it somehow, starting with the original commit and fixing the problem that replies are not properly processed.

  • hence the changes to CalDAV/Schedule/Plugin.php are just as before. The original commit indeed was enough to trigger sending out invitations to the participants
  • the missing thing is that the replies could not be parsed by Sabre because the referenced calendar objects (i.e. the events) could not be found.

The linked issue #26668 mentions a function getUsersOwnCalendars() which at least nowadays is hardly used any more safe in one place. Instead, we have to inspect getCalendarObjectByUID() as this is the real show stopper: if you start to examine things and try to understand why the responses of the invited parties are not processed, then you finally hit this point in the Sabre library:

https://github.com/sabre-io/dav/blob/2d8f6d9b9851a3d5fec007b7033d86b1dc241663/lib/CalDAV/Schedule/Plugin.php#L492

This point is met when the invitees send back their responses (accept, decline, not yet). The problem is now that the API documentation states:

    * This method should only consider * objects that the principal owns, so
     * any calendars owned by other principals that also appear in this
     * collection should be ignored.

"unfortunately" NC sticks to this requirement, and consequently the referenced event cannot be found.

This pull-request just ignores this requirements and changes getCalendarObjectByUID() such that it also finds objects in shared writeable calendars and adjusts their URI to the currently used ..._shared_by_... layout.

This seems to be enough to establish the basic functionality which unfortunately still is advertised by the Nextcloud calendar frontend but up to now just does not work and irritates (not only end-)users.

As mentioned at the start of this too-long-a-comment: I do not consider this as "the solution". Just a code study ...

apps/dav/lib/CalDAV/CalDavBackend.php Fixed Show resolved Hide resolved
apps/dav/lib/CalDAV/CalDavBackend.php Fixed Show fixed Hide fixed
apps/dav/lib/CalDAV/Schedule/Plugin.php Fixed Show fixed Hide fixed
apps/dav/lib/CalDAV/CalDavBackend.php Fixed Show fixed Hide fixed
apps/dav/lib/CalDAV/CalDavBackend.php Fixed Show fixed Hide fixed
apps/dav/lib/CalDAV/Schedule/Plugin.php Fixed Show resolved Hide resolved
apps/dav/lib/CalDAV/Schedule/Plugin.php Fixed Show resolved Hide resolved
apps/dav/lib/CalDAV/Schedule/Plugin.php Fixed Show resolved Hide resolved
@ChristophWurst ChristophWurst marked this pull request as draft February 17, 2023 08:26
@ChristophWurst ChristophWurst added 2. developing Work in progress feature: dav feature: caldav Related to CalDAV internals labels Feb 17, 2023
@ChristophWurst ChristophWurst changed the title WIP Feature/shared calendar invitations Shared calendar invitations Feb 17, 2023
@rotdrop
Copy link
Contributor Author

rotdrop commented Feb 17, 2023

Oops. This is caused by me testing this with NC25 but diffing against master. Actually, I do not have the master branch running such that I could do real testing ... so this needs quite a bit of polishing.

The commits should actually work with v25.

@ChristophWurst
Copy link
Member

That is fine for a proof of concept

@rotdrop rotdrop force-pushed the feature/shared-calendar-invitations branch 2 times, most recently from 25fe2fa to 5219c61 Compare February 17, 2023 12:11
apps/dav/lib/CalDAV/CalDavBackend.php Fixed Show fixed Hide fixed
apps/dav/lib/CalDAV/CalDavBackend.php Fixed Show fixed Hide fixed
apps/dav/lib/CalDAV/CalDavBackend.php Fixed Show fixed Hide fixed
apps/dav/lib/CalDAV/CalDavBackend.php Fixed Show fixed Hide fixed
apps/dav/lib/CalDAV/CalDavBackend.php Fixed Show fixed Hide fixed
apps/dav/lib/CalDAV/CalDavBackend.php Fixed Show fixed Hide fixed
apps/dav/lib/CalDAV/CalDavBackend.php Fixed Show fixed Hide fixed
@rotdrop rotdrop force-pushed the feature/shared-calendar-invitations branch 3 times, most recently from 3167c73 to 4025649 Compare February 17, 2023 13:45
apps/dav/lib/CalDAV/CalDavBackend.php Fixed Show fixed Hide fixed
apps/dav/lib/CalDAV/Calendar.php Fixed Show fixed Hide fixed
apps/dav/lib/CalDAV/CalDavBackend.php Fixed Show fixed Hide fixed
@rotdrop rotdrop force-pushed the feature/shared-calendar-invitations branch 2 times, most recently from 50c14cc to 1195397 Compare February 17, 2023 13:56
apps/dav/lib/CalDAV/CalDavBackend.php Fixed Show fixed Hide fixed
apps/dav/lib/CalDAV/Calendar.php Fixed Show fixed Hide fixed
@rotdrop rotdrop force-pushed the feature/shared-calendar-invitations branch 3 times, most recently from 9bc44d7 to c829cff Compare February 17, 2023 14:24
@rotdrop
Copy link
Contributor Author

rotdrop commented Feb 17, 2023

Ok, there was much more than mere compatibility between v25 and master. For the moment most tests seem to have passed.

@rotdrop
Copy link
Contributor Author

rotdrop commented Feb 17, 2023

"continues integration" fails due to some S3 issues. I do not think that this is related to my changes.

@rotdrop
Copy link
Contributor Author

rotdrop commented Feb 17, 2023

I have moved the SharingSupport stuff to a separate pull-requests as my impression currently is that this does not bring us closer to sending invitations, see #36766.

@rotdrop rotdrop force-pushed the feature/shared-calendar-invitations branch 4 times, most recently from 76d5902 to 4ad3f07 Compare February 21, 2023 20:19
This is basically the original commit, but with the addition that
CalDavBackend::getCalendarObjectByUID() also takes object in writable
shared calendars in to account and adjusts their uri s.t. the Sabre
library can find the returned object uri in the user's calendar
collection.

Signed-off-by: Claus-Justus Heine <himself@claus-justus-heine.de>
Signed-off-by: Claus-Justus Heine <himself@claus-justus-heine.de>
… over private objects.

Signed-off-by: Claus-Justus Heine <himself@claus-justus-heine.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2. developing Work in progress feature: caldav Related to CalDAV internals feature: dav
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants