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

Move calendar objects between calendars #30120

Merged
merged 1 commit into from
Mar 16, 2022

Conversation

miaulalala
Copy link
Contributor

@miaulalala miaulalala commented Dec 6, 2021

When moving a calendar object from calendar A to calendar B, move the object instead of copying it to the new calendar and deleting the old object.

Fixes nextcloud/calendar#3325

@miaulalala miaulalala added enhancement 3. to review Waiting for reviews labels Dec 6, 2021
@miaulalala miaulalala self-assigned this Dec 6, 2021
@miaulalala miaulalala requested a review from a team December 6, 2021 19:19
@miaulalala miaulalala added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Dec 6, 2021
@nickvergessen
Copy link
Member

Not sure I have enough meta knowledge. But are URIs unique per calendar or globally? So could there be an error when moving a to be duplicate-URI element to another calendar which already has this URI?

@come-nc
Copy link
Contributor

come-nc commented Dec 7, 2021

Lots of potential issues spotted by psalm.

apps/dav/lib/CalDAV/CalendarObject.php Outdated Show resolved Hide resolved
apps/dav/lib/CalDAV/CalendarObject.php Outdated Show resolved Hide resolved
apps/dav/lib/CalDAV/Calendar.php Outdated Show resolved Hide resolved
apps/dav/lib/CalDAV/CalDavBackend.php Outdated Show resolved Hide resolved
apps/dav/lib/CalDAV/CalDavBackend.php Outdated Show resolved Hide resolved
apps/dav/lib/CalDAV/CalDavBackend.php Outdated Show resolved Hide resolved
apps/dav/lib/CalDAV/Calendar.php Outdated Show resolved Hide resolved
apps/dav/lib/CalDAV/CalDavBackend.php Show resolved Hide resolved
apps/dav/lib/CalDAV/CalDavBackend.php Outdated Show resolved Hide resolved
apps/dav/lib/CalDAV/Calendar.php Outdated Show resolved Hide resolved
@gohrner
Copy link

gohrner commented Dec 13, 2021

@miaulalala: I don't want to discredit this implementation, but to me it sounds as if it only catches a corner case.

I guess this PR won't help in cases where an event is moved from one calendar managed in Nextcloud to another calendar managed by some other server, and back again?

Nextcloud server will still have to provide a solution for this case in order not to break other CalDAV clients.

How about - probably in addition to this feature implemented here - allowing the Nextcloud Calender to "resurrect" and update items in the trashbin transparently if they are re-added by any client? This would also solve the "multiple servers" issue, and also additional ones (basically getting the CalDAV interface's semantics - to my knowledge - back in line with the RFCs).

@miaulalala
Copy link
Contributor Author

@miaulalala: I don't want to discredit this implementation, but to me it sounds as if it only catches a corner case.

I guess this PR won't help in cases where an event is moved from one calendar managed in Nextcloud to another calendar managed by some other server, and back again?

Nextcloud server will still have to provide a solution for this case in order not to break other CalDAV clients.

How about - probably in addition to this feature implemented here - allowing the Nextcloud Calender to "resurrect" and update items in the trashbin transparently if they are re-added by any client? This would also solve the "multiple servers" issue, and also additional ones (basically getting the CalDAV interface's semantics - to me knowledge - back in line with the RFCs).

I guess it depends on your definiton of "edge case" ;) but you're right, this does indeed not help with the problem of deletion conflicts.

I'll address this in a different PR.

@st3iny
Copy link
Member

st3iny commented Jan 28, 2022

Failing drone tests seem to be related (e.g. OCA\DAV\Tests\Command\DeleteCalendarTest::testInvalidUser).

@miaulalala
Copy link
Contributor Author

Drone Failure unrelated (Samba)

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.

Just a nitpick

apps/dav/lib/CalDAV/Calendar.php Show resolved Hide resolved
@ChristophWurst ChristophWurst mentioned this pull request Feb 15, 2022
26 tasks
Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

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

Looks good!

As a (future) enhancement this is also a good example of an operation we should do atomically. Either the calendar gets moved and the changes are tracked in the sync table, or everything is rolled back. Ref #31205.

apps/dav/lib/CalDAV/Calendar.php Outdated Show resolved Hide resolved
apps/dav/lib/CalDAV/CalDavBackend.php Outdated Show resolved Hide resolved
apps/dav/lib/CalDAV/CalDavBackend.php Outdated Show resolved Hide resolved
apps/dav/lib/CalDAV/CalDavBackend.php Show resolved Hide resolved
@miaulalala miaulalala requested review from tcitworld, ChristophWurst, a team, PVince81, skjnldsv and CarlSchwan and removed request for a team March 10, 2022 10:50
…ating them

Signed-off-by: Anna Larch <anna@nextcloud.com>
@miaulalala miaulalala force-pushed the enhancement/move-calendar-objects branch from 1facde6 to 0745fc5 Compare March 16, 2022 11:49
@miaulalala miaulalala merged commit 629bcf1 into master Mar 16, 2022
@miaulalala miaulalala deleted the enhancement/move-calendar-objects branch March 16, 2022 14:41
@miaulalala miaulalala added this to the Nextcloud 24 milestone Mar 16, 2022
@kartoffelheinz

This comment was marked as off-topic.

tcitworld added a commit that referenced this pull request Mar 21, 2023
…ddressBook

This allows to just UPDATE the card row instead of deleting it and reinsert it. It's very similar to #30120 for calendars.

As we need the addressbookid exposed, this introduces OCA\DAV\CardDAV\Card that extends Sabre's.

I chose specifically NOT to auto-inject LoggerInterface in Addressbook like in #30120 because the chain of DI is huge just for ONE simple call and it would break an existing dirty call (OCA\Contacts calling OCA\DAV) of ContactsManager in Contacts: nextcloud/contacts#1722 (in SocialApiService), but this is debatable.

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
tcitworld added a commit that referenced this pull request Mar 21, 2023
…ddressBook

This allows to just UPDATE the card row instead of deleting it and reinsert it. It's very similar to #30120 for calendars.

As we need the addressbookid exposed, this introduces OCA\DAV\CardDAV\Card that extends Sabre's.

I chose specifically NOT to auto-inject LoggerInterface in Addressbook like in #30120 because the chain of DI is huge just for ONE simple call and it would break an existing dirty call (OCA\Contacts calling OCA\DAV) of ContactsManager in Contacts: nextcloud/contacts#1722 (in SocialApiService), but this is debatable.

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
tcitworld added a commit that referenced this pull request Mar 21, 2023
…ddressBook

This allows to just UPDATE the card row instead of deleting it and reinsert it. It's very similar to #30120 for calendars.

As we need the addressbookid exposed, this introduces OCA\DAV\CardDAV\Card that extends Sabre's.

I chose specifically NOT to auto-inject LoggerInterface in Addressbook like in #30120 because the chain of DI is huge just for ONE simple call and it would break an existing dirty call (OCA\Contacts calling OCA\DAV) of ContactsManager in Contacts: nextcloud/contacts#1722 (in SocialApiService), but this is debatable.

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
nextcloud-command pushed a commit that referenced this pull request Apr 24, 2023
…ddressBook

This allows to just UPDATE the card row instead of deleting it and reinsert it. It's very similar to #30120 for calendars.

As we need the addressbookid exposed, this introduces OCA\DAV\CardDAV\Card that extends Sabre's.

I chose specifically NOT to auto-inject LoggerInterface in Addressbook like in #30120 because the chain of DI is huge just for ONE simple call and it would break an existing dirty call (OCA\Contacts calling OCA\DAV) of ContactsManager in Contacts: nextcloud/contacts#1722 (in SocialApiService), but this is debatable.

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
tcitworld added a commit that referenced this pull request Apr 26, 2023
…ddressBook

This allows to just UPDATE the card row instead of deleting it and reinsert it. It's very similar to #30120 for calendars.

As we need the addressbookid exposed, this introduces OCA\DAV\CardDAV\Card that extends Sabre's.

I chose specifically NOT to auto-inject LoggerInterface in Addressbook like in #30120 because the chain of DI is huge just for ONE simple call and it would break an existing dirty call (OCA\Contacts calling OCA\DAV) of ContactsManager in Contacts: nextcloud/contacts#1722 (in SocialApiService), but this is debatable.

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
tcitworld added a commit that referenced this pull request Apr 26, 2023
…ddressBook

This allows to just UPDATE the card row instead of deleting it and reinsert it. It's very similar to #30120 for calendars.

As we need the addressbookid exposed, this introduces OCA\DAV\CardDAV\Card that extends Sabre's.

I chose specifically NOT to auto-inject LoggerInterface in Addressbook like in #30120 because the chain of DI is huge just for ONE simple call and it would break an existing dirty call (OCA\Contacts calling OCA\DAV) of ContactsManager in Contacts: nextcloud/contacts#1722 (in SocialApiService), but this is debatable.

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
tcitworld added a commit that referenced this pull request Apr 27, 2023
…ddressBook

This allows to just UPDATE the card row instead of deleting it and reinsert it. It's very similar to #30120 for calendars.

As we need the addressbookid exposed, this introduces OCA\DAV\CardDAV\Card that extends Sabre's.

I chose specifically NOT to auto-inject LoggerInterface in Addressbook like in #30120 because the chain of DI is huge just for ONE simple call and it would break an existing dirty call (OCA\Contacts calling OCA\DAV) of ContactsManager in Contacts: nextcloud/contacts#1722 (in SocialApiService), but this is debatable.

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
tcitworld added a commit that referenced this pull request May 16, 2023
…ddressBook

This allows to just UPDATE the card row instead of deleting it and reinsert it. It's very similar to #30120 for calendars.

As we need the addressbookid exposed, this introduces OCA\DAV\CardDAV\Card that extends Sabre's.

I chose specifically NOT to auto-inject LoggerInterface in Addressbook like in #30120 because the chain of DI is huge just for ONE simple call and it would break an existing dirty call (OCA\Contacts calling OCA\DAV) of ContactsManager in Contacts: nextcloud/contacts#1722 (in SocialApiService), but this is debatable.

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews enhancement
Projects
Development

Successfully merging this pull request may close these issues.

Moving events back and forth between calendars causes trash bin conflicts
9 participants