Edit file should guide you properly if you don't have the proper authorizations
Resources
PM @victorwu | UX @hazelyang | FE @MadLittleMods
Description
Right now on https://about.gitlab.com/ we link to https://gitlab.com/gitlab-com/www-gitlab-com/blob/master/source/index.html.haml to edit the page. This means that people that are logged in with edit rights always need to press the edit button to make a change. I want to be able to link to the edit page https://gitlab.com/gitlab-com/www-gitlab-com/edit/master/source/index.html.haml instead.
There are a couple of cases:
For branches:
-
Logged in but edit rights on branches => Prompt to create a branch? already exists. You get an edit file screen and you can name the
For master:
- Not logged in:
- When you view the file page, the edit button is still displayed and active.
- When you click the edit button, it redirects you to the login page.
- When you click on a link anywhere online that is equivalent, i.e. (
https://gitlab.com/gitlab-com/www-gitlab-com/edit/master/source/index.html.haml
) , it redirects you to the login page. - After you log in, it redirects you back to the file in edit mode if you have permissions to edit it.
- After you log in, if you don't have permissions to edit it, it just redirects you back to the same page. new branch as part of that web form submit.
- Logged in with edit rights on the file: When you click the edit button it sends you to the edit mode of the file.
- Logged in but no rights on the repo: When you click the edit button it prompts you with the inline fork menu.
Design
If people have no permissions on creating a branch, we ask them to fork.
If they agree, we fork and then send them to the edit file page, on the master branch of their fork, with a banner message.
If they have already previously forked, we just redirect them to the edit file page on the master branch of their fork, with a banner message. That edit file page is instead a new file page if that file was previously deleted on that master branch of the fork.