Skip to content

Allow to edit files from a commit or tag with WebIDE

What does this MR do and why?

This re-instates frontend changes from reverted !159557 (merged)

Create a separate condition for WebIDE to decided if a fork is needed. Comparing to can_modify_blob, this one won't check if the ref is on top of the branch (return false unless on_top_of_branch?(project, ref)) and only checks if a given user can collaborate with the project. It will allow for using Edit button to enter WebIDE from blob, even when browsing the repository at a commit or a tag.

Here's more context how we landed on this fix: #410476 (comment 2001422540)

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Context Before After
user that has editing permissions and is browsing a commit Screen_Recording_2024-07-24_at_15.10.08 Screen Recording 2024-07-24 at 09.52.19.mov
user without editing permissions Screen_Recording_2024-07-24_at_15.09.32 Screen Recording 2024-07-24 at 09.32.16.mov

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Visit a project
  2. Got to Commits page and click a folder icon on any commit from the list.
  3. Choose a file to edit
  4. Notice that choosing Edit with Single file editor shows information about a fork. Edit with WebIDE works.
  5. From a ref selector choose a tag.
  6. Notice that choosing Edit with Single file editor shows information about a fork. Edit with WebIDE works.
  7. From a ref selector choose a branch
  8. You should be able to edit the file with a preferred editor.

Related to #475182 (closed)

Edited by Paulina Sedlak-Jakubowska

Merge request reports

Loading