Autosave collision detection does not alert user or prevent further overwriting content
|Reported by:||benbalter||Owned by:||IAmWilliamWallace|
When editing a post, upon detecting that another user has modified that same post, the autosave function neither alerts the user as to the conflict nor does it prevent the user from overwriting the other user's changes.
To reproduce: Login as a user ("User 1") and edit an existing post. Open a 2nd incognito/private browsing window and login as a different user ("User 2"). Navigate to the same post and hit update as User 2. Although admin-ajax pushes a notice through its response, User 1 has no way of knowing that User 2 now has the file lock.
Believe the problem lies in line 89 of autosave.dev.js.
message = res.responses.data;
The error data is being properly passed form admin-ajax, but is not being properly handled on the client side.
The issue is that the error message doesn't end up in the expected location in the response. The attached patch looks in the second location for the message as appropriate. However, a proper fix might instead be in wpAjax, as the intent might be that responses.data should be reflecting the error message.
Beyond notice in the ajax message window, as an additional enhancement (for another ticket), at the very least errors should be big, red, and possibly with the <blink> tag, perhaps a modal dialog or other means of temporarily disabling update (and re-enabling autosave) may be prudent as well. A div class="error" should probably be desired behavior, similar to other warnings sometimes shown here.
Change History (19)
comment:1 in reply to: ↑ description nacin — 3 years ago
- Keywords has-patch dev-feedback added; needs-patch 2nd-opinion removed
- Keywords ux-feedback added; dev-feedback removed
- Version changed from 3.1 to 3.0
- Resolution fixed deleted
- Status changed from closed to reopened
- Owner set to IAmWilliamWallace
- Status changed from reopened to accepted