Render a different error message when committing to a fork
What does this MR do and why?
The error message for editing a file when the latest commit on that file for the project being committed to is different is sometimes not helpful
When a user doesn't have write permissions to a project they are prompted to fork the project and make changes there instead, if the fork diverges from the main project the above error message doesn't quite apply.
The change in this MR is to render a different error message when appropriate.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
Validate handling diverged fork:
- Create a project (For example: http://127.0.0.1:3000/root/editing-from-fork)
- Using a separate user that does not have write permissions to the project try to edit a file (For example: http://127.0.0.1:3000/root/trouble-editing-from-fork/-/edit/main/upstream_file)
- When prompted to fork the project, click the fork button
- After the fork is complete edit the file from the fork (not the upstream. For example: http://127.0.0.1:3000/user20/trouble-editing-from-fork/-/edit/main/upstream_file)
- Try editing the file from the upstream project again(http://127.0.0.1:3000/root/trouble-editing-from-fork/-/edit/main/upstream_file)
- See an error message suggesting editing the file on the fork
Validating existing flow still works when appropriate:
- Create a project (For example: http://127.0.0.1:3000/root/editing-from-fork)
- Start editing a file without submitting the form: (For example: http://127.0.0.1:3000/root/trouble-editing-from-fork/-/edit/main/upstream_file)
- Push changes to that file
- Submit the form and see the error message that someone has edited the file at the same time
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #344518 (closed)