You’ve signed the CLA, nbianca. Thank you! This pull request is ready for review.
This is very cool
Any reasons we’re not always sending the
originalText? Conflicts are not limited to wiki posts.
The “double negation” feels weird.
if raw_old.present? && raw_old != post.raw
There should be a test for that
There should be a spec for that.
Maybe this instead?
edit_conflict: "That post was edited by another user and your changes can no longer be saved."
The absence of
raw_old will skip the check on server side.
raw_old will be sent so the server can check if there is a problem. The second time (after a
raw_old will not be sent anymore which will bypass the check and overwrite the content.
However, I do agree that it could work for all posts, not just wiki. The spec mentioned only these and I meant to ask you about it.
The code itself explains the behavior quite clearly so I’m not sure if we really need this comment here.
We have a pattern for rendering json errors, you can have a look at
Hmm this is never saved so the raw that the controller is seeing is different.
Ah, yes. It’s actually not needed at all. The test only requires
raw_old and the actual post content to be different.
This PR doesn’t match our required code formatting standards, as enforced by prettier.io. Here’s how to set up prettier in your code editor.
Generated by :no_entry_sign: Danger
Fixed and also changed one more occurrence of the same pattern above.