Disable Open in Web IDE button in merge requests where the user does not have write permissions

When a user wants to edit a project but does not have permissions we need to prevent them from opening the Web IDE, making changes and having no way to save them. In the merge request interface everyone can open the Web IDE.

Steps to reproduce

  1. Login and open a public project that you are not a member of (no write permissions)
  2. Open a merge request and click Web IDE

Example Project

https://gitlab.com/inkscape/inkscape

What is the current bug behavior?

I can open the Web IDE, edit files, but I will receive an error when trying to commit.

What is the expected correct behavior?

I should not be able to open the Web IDE.

Output of checks

This bug happens on GitLab.com

Possible fixes

Disable the Web IDE button in the merge request widget if I do not have any write access to the project.

Edited by James Ramsay (ex-GitLab)