Steps to reproduce
- As a user without script right, create a page with the content {{velocity}}$xcontext.user{{/velocity}}.
- As Admin, click on "Edit" on this page. The "Warning" page with the "Force editing" button is displayed because editing the page may result in the execution of currently disabled scripts.
- Click on "Cancel" (or leave the page in any other way).
- As another user, edit the page.
Expected result The page can be edited. Actual result The edit confirmation says that the page is currently locked by Admin, although Admin never opened the editor. The lock stays until it expires or Admin cancels an edit of the page. Cause EditAction#render locks the document before edit.vm checks the edit confirmations. When a confirmation is needed, edit.vm displays it instead of the editor, but nothing releases the lock:
- The "Cancel" button is a link to the view mode, not to the cancel action that removes the lock.
- $editor isn't set on the confirmation page, so XWiki.editor is empty and lock.js doesn't consider the page as locked, so it doesn't send the cancel request when the page is left.
This applies to every edit confirmation that can be forced and isn't about a lock held by another user (required rights, pages installed by an extension). In the docker tests, it made one failing test in VersionIT leave XWiki.XWikiPreferences locked and fail several other tests of the suite (see XWIKI-24822). |