server
server copied to clipboard
Calendar and Contacts Trashbin
We already provide a trash bin for files, that allows users to restore deleted files. I'd like to see something similar for calendars and contacts.
This also helps users who accidentally deleted events/contacts or an entire calendar/addressbook in their client.
Todo
- [x] Calendar and event trash bin
- [ ] Calendar subscription trash bin
- [ ] Address book and contact card trash bin
cc @jancborchardt @tcitworld @schiessle
There are a few questions that need a prior discussion:
- Which app shall implement the features logic?
dav- a new
dav_trashbin calendarrespectivelycontacts
I'd not like to see it in the latter, because you can use CalDAV and CardDAV without the Calendar and Contacts app. Therefore the trash bin should always work, no matter whether the web gui is enabled.
- Which app shall implement the GUI?
davrespectivelydav_trashbinin the personal settings areacalendarrespectivelycontacts
I'd actually go with calendar and contacts here. We can't do this with plain CalDAV/CardDAV. Therefore it's acceptable to having enable calendar respectively contacts before restoring imo.
I'd suggest to provide the trash bin via remote.php/dav/calendars_trashbin/ respectively remote.php/dav/addressbooks_trashbin/.
@schiessle I wasn't able to find the trash bin via remote.php/dav/. Does files_trashbin already use WebDAV for talking to the server?
However it would be of no use if the calendar/contacts app aren't here since you wouldn't be able to restore deleted calendars/contacts.
Yes, but there are the following scenarios:
Dav app takes care: You delete a calendar by accident -> the calendar is moved to a trash bin by the dav app -> you enable the calendar app -> you restore the calendar
Calendar app takes care: You delete a calendar by accident -> ¯_(ツ)_/¯
Totally agree with all of these. If I understand correctly, putting an item in the bin would mean moving the data from the oc_calendars table to oc_calendar_bin, while not touching oc_calendar_objects. Do the data from oc_dav_shares must remain too ?
Couldn't we just create a flag, and some sort of hidden calendars/events which are not exposed, unless you propfind with a the special property? I think that would be very few lines to implement.
When you delete a calendar/event and it does not have the flag yet, we set the flag. If the flag already exists it's deleted from the system.
That would indeed be a good solution. Instead of the flag I'd probably go for a timestamp, which is null by default. This allows us to easily delete deleted calendars/events older than n days.
But there is actually one issues I'd like to discuss before implementing this:
When a calendar/addressbook (but also event/contact) is deleted, the uid should be available again. What to do about this? Replace the uid (or uri for event/contact) with a random string?
Keep this random string when replacing or tell the client to send a new uid along the request?
The dav_shares table uses the calendar id and not the calendar uri, we don't need to change anything there.
The behavior should be the same as in the files app. Restoring a calendar/addressbook also restores all the shares.
Reminder for myself: Do not return deleted calendars on allprop request
When a calendar/addressbook (but also event/contact) is deleted, the uid should be available again. What to do about this? Replace the uid (or uri for event/contact) with a random string?
As long as there are no duplicates on restoring, fine by me.
Yes, the db won't allow duplicate URIs. https://github.com/nextcloud/server/blob/master/apps/dav/appinfo/database.xml#L375
Regarding where to store it – definitely directly in the Calendar respectively the Contacts app. cc @Henni @irgendwie
Do you mean store or restore?
Please excuse my brevity and typos. Sent from my mobile
On Oct 11, 2016, at 9:36 AM, Jan-Christoph Borchardt [email protected] wrote:
Regarding where to store it – definitely directly in the Calendar respectively the Contacts app. cc @Henni @irgendwie
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub, or mute the thread.
A bit late to the discussion, but I agree with the conclusion by @georgehrke. Think this is a good way forward.
@georgehrke it was a reply to your previous question:
Which app shall implement the features logic?
And I think it should be the respective app. Definitely not a new calendar_trashbin app or something like that which needs to be separately enabled.
Please see https://github.com/nextcloud/server/issues/1662#issuecomment-252332641 on why I think this is a really bad idea. You can use CalDAV and CardDAV without enabling the respective apps.
@jancborchardt this would mean that the calendar app has to be installed to offer a trashbin to all other clients. I'd prefer to implement only the gui inside the respective apps (contacts & calendar) and implement the backend (functionality) inside a different app, maybe extend dav_trashbin or even create new apps (which are enabled by default).
I would really prefer to just put it in the dav app. This feature requires a Plugin for Sabre/Dav and at the moment there is no way for other apps to register sabre/Dav plugins. All the other things like comments and tags are also in the dav app.
Ok, putting it in the dav app seems to make most sense then. :)
Can this be done for Tasks in the Tasks app too? Since that also uses Dav...
@olantrust should be possible. cc @raimund-schluessler
I created an issue: https://github.com/nextcloud/tasks/issues/29
Hi, just came over this issue. Is there any progress?
I think it would be fine to separate this issue in at least two or three issues. The first step may be just having a trashbin for events. Second a trashbin for contacts (I do not know how much differeces there are compared to events). Third it seemst to me a bit more complicated having a trashbin for a whole calendar. Indeed I do not know whether this is realy necessary although it is nice to have. It is no common mistake that someone deletes accidently whole calendar.
Further for the event trashbin it would be useful to have it as extra calendar. That means you could view your trashbin calendar as every other calender (also sync it if you like). Deleting an event simply means to move the event from the origin calendar to the trashbin calender. Restore is moving back. Maybe it is necessary to remember the origin calender for automatically moving back. For me it would be enough to see the event and have the ability to move it back manually.
Are we have any SQL command can recover calendar delete events??? I have a big trouble for this...lol
No, the calendar / contacts trash bin wasn’t implemented yet. I’m afraid gone is gone.
OMG..... Thanks your answer. Activity only log the event title? No any startdate - enddate? Maybe my boss will kill me...
Activity only log the event title? No any startdate - enddate?
Only the title, yes https://github.com/nextcloud/server/blob/ba3c608a00f3834f743de5a0cd82ddae3825d458/apps/dav/lib/CalDAV/Activity/Backend.php#L477
I think if somebody takes a look at this she*he should think about logging the change to the activity app nextcloud/server#3549.
Folks, let's be civil here. Yes, a way to recover deleted Contacts & Calendars would be great. 2 options:
- Can you help? Great! Dive into the code, communicate with the other developers, and let's make this real.
- OR can you not help and just want to comment here: Do not. It's notifying everyone subscribed to this issue and wastes their time. And if your comment is negative, it will make people even less likely to implement what you want to have.
@georgehrke Nothing for 14, right? Move to 15 or backlog?
Backlog for now
I just accidentally deleted my contact list and I now lost all my contacts on both my phone and my computer. How is this even possible!?