Updated: Comment #1
The Views interface locks itself if two users try to edit the same view. The "locked out" user however still has access to the "Save" and "Cancel" buttons. Clicking either button will immediately break the lock and either save the view, or discard the other user's changes. Considering clicking the Cancel button is the most natural thing for a user to do if someone else is already editing the same view, this seems like it could frequently lead to loss of in-progress configuration.

Problem/Motivation

To reproduce:

  1. Install D8, create a second user with the administrator role.
  2. With UID1, visit admin/structure/views/view/frontpage/edit/page_1, make any change to the view.
  3. With UID2, visit admin/structure/views/view/frontpage/edit/page_1. You should get the message "This view is being edited by user [user-name], and is therefore locked from editing by others. This lock is 2 sec old. Click here to break this lock."
  4. Click the "Cancel" button as UID2. The lock on the View is mistakenly broken. UID1's changes are lost.

Proposed resolution

Unknown

Remaining tasks

Create a patch.

User interface changes

Unknown

API changes

Unknown

Original report by @quicksketch

The Views interface locks itself if two users try to edit the same view. The "locked out" user however still has access to the "Save" and "Cancel" buttons. Clicking either button will immediately break the lock and either save the view, or discard the other user's changes. Considering clicking the Cancel button is the most natural thing for a user to do if someone else is already editing the same view, this seems like it could frequently lead to loss of in-progress configuration.

To reproduce:

- Install D8, create a second user with the administrator role.
- With UID1, visit admin/structure/views/view/frontpage/edit/page_1, make any change to the view.
- With UID2, visit admin/structure/views/view/frontpage/edit/page_1. You should get the message "This view is being edited by user [user-name], and is therefore locked from editing by others. This lock is 2 sec old. Click here to break this lock."
- Click the "Cancel" button as UID2. The lock on the View is mistakenly broken. UID1's changes are lost.

Comments

jibran’s picture

Issue summary: View changes
Issue tags: +VDC

Tagging.

dawehner’s picture

Thanks for reporting the issue.
I guess the proper solution would be to not offer a cancel nor a submit button?

olli’s picture

Status: Active » Needs review
StatusFileSize
new1.37 KB

Something like this?

Status: Needs review » Needs work

The last submitted patch, 3: 2156853.patch, failed testing.

olli’s picture

Status: Needs work » Needs review
StatusFileSize
new2.17 KB
new814 bytes
berdir’s picture

Cancel is a destructive action too, unlike other forms, it destroys the temporary changes, it possibly needs a different cancel (iink?) that just goes back.

tim.plunkett’s picture

I think the back button of a browser is sufficient here. We just remove the cancel button if its locked.

dawehner’s picture

Cancel is a destructive action too, unlike other forms, it destroys the temporary changes, it possibly needs a different cancel (iink?) that just goes back.

I would assume another cancel link would do more harm than good. I cannot see how this cannot be confusing for the user.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

.

berdir’s picture

Fine with me but the current patch is still showing the destructive cancel button that reverts all changes... :)

olli’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new834 bytes
new2.5 KB

Added a small test.

The last submitted patch, 11: vdc-2156853-fail.patch, failed testing.

The last submitted patch, 11: vdc-2156853-fail.patch, failed testing.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Thank you!

catch’s picture

Status: Reviewed & tested by the community » Needs work

Would prefer we set #access than conditionally set/remove the form elements - makes it easier for form_alter() etc.

olli’s picture

Status: Needs work » Needs review
StatusFileSize
new2.38 KB
new1.91 KB

Good point, thank you!

quicksketch’s picture

Status: Needs review » Reviewed & tested by the community

Tested and it works for me. Nice touch to again check lock status on validation, in the event that the user had access to edit the view but another user saved the view out from under them. The workflow is still a little weird (the validation error comes up in the preview area), but it prevents the potentially config-losing situation where a user overwrites another user's changes.

damiankloip’s picture

+1, this looks good to me.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.