Skip to content

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 Screenshot_2023-03-27_at_12.04.27_PM

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:

  1. Create a project (For example: http://127.0.0.1:3000/root/editing-from-fork)
  2. 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)

Screenshot_2023-03-27_at_11.55.11_AM

  1. When prompted to fork the project, click the fork button
  2. 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)
  3. Try editing the file from the upstream project again(http://127.0.0.1:3000/root/trouble-editing-from-fork/-/edit/main/upstream_file)
  4. See an error message suggesting editing the file on the fork Screenshot_2023-03-29_at_11.28.47_AM

Validating existing flow still works when appropriate:

  1. Create a project (For example: http://127.0.0.1:3000/root/editing-from-fork)
  2. 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)
  3. Push changes to that file
  4. 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.

Related to #344518 (closed)

Edited by Jerry Seto

Merge request reports

Loading