Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WJ-1020] Require passing in last revision ID for page operations #2117

Merged
merged 5 commits into from
Oct 7, 2024

Conversation

emmiegit
Copy link
Member

@emmiegit emmiegit commented Oct 7, 2024

This is a safety measure to protect against the following case:

  1. Alice opens page X, which at the time is at revision 10.
  2. Bob opens page X, which is also at revision 10.
  3. Bob makes an edit on page X, so it is now on revision 11.
  4. Alice, with the page still open on X (but the editor is not open, avoiding any page lock conflicts), edits.
  5. Alice's revision 12 has effectively overwritten Bob's edit 11, since she was not seeing the contents of revision 11 on her screen when she was drafting her changes.

Page locking does not help here since at no point are Alice and Bob attempting to commit the page at the same time. By requiring the frontend pass in the last revision ID for the page (which is already received by framerail as part of the page data), we ensure that if someone has an old version of the page locally loaded in their browser, they are effectively forced to reload if the page has been edited since.

This revision ID is only required for "destructive" operations, like edits, deletes, rollbacks, etc, where a user may possibly take a different action if they knew the page had been updated in the meantime.

I plan to make a similar change for file operations (see WJ-1281).

@emmiegit emmiegit self-assigned this Oct 7, 2024
@emmiegit emmiegit requested a review from Zokhoi October 7, 2024 04:14
@emmiegit emmiegit merged commit aedad53 into develop Oct 7, 2024
8 checks passed
@emmiegit emmiegit deleted the WJ-1020-last-revision branch October 7, 2024 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants