nextcloud / calendar

📆 Calendar app for Nextcloud
https://apps.nextcloud.com/apps/calendar
GNU Affero General Public License v3.0
965 stars 237 forks source link

Improve error handling in case an event in a shared calendar was edited by someone else #6166

Open st3iny opened 1 month ago

st3iny commented 1 month ago

Is your feature request related to a problem? Please describe.

Let there be two users A and B that share a calendar with read and write permissions.

  1. User A start editing an event.
  2. User B starts editing the same event but saves first.
  3. User A tries to save their changes.

Result: User A will get a generic error toast in the lines of Failed to save event.

Describe the solution you'd like

Improve the error message and show something like The event was edited by someone else in the meantime. Please close the event and try again..

Christoph even suggested to go one step further and already show a warning while editing the event in case it has been updated by someone else. There is nothing more frustrating than having to retype extensive changes.

The error can be caught and handled pretty well as the server will respond with 412 Precondition Failed in those cases.

Describe alternatives you've considered

None

Additional context

A nice follow-up to https://github.com/nextcloud/calendar/pull/6152.

SebastianKrupinski commented 1 month ago

@st3iny +1 for Christoph's idea.

I would also include a ACL check in case the Sharer removes edit permission's while the Sharee is Adding/Editing.

SebastianKrupinski commented 1 month ago

@st3iny Ooooo... how hard would it be to implement edit locking? User A starts to edit the event, User B sees the event as Read Only...

We would need to check the event status between refresh cycles, in case User B tries to edit the event before its refreshed, then just update the status in the cache and show it as read only, maybe with a message "Event is being edited by User A".

I can work on the backend if you do the front end.

This would be a great live feed back feature.