Show fork suggestion when user cannot perform in add-to-tree dropdown
<!--IssueSummary start--> <details> <summary> Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards. </summary> - [Work on this issue](https://contributors.gitlab.com/manage-issue?action=work&projectId=278964&issueIid=523226) - [Close this issue](https://contributors.gitlab.com/manage-issue?action=close&projectId=278964&issueIid=523226) </details> <!--IssueSummary end--> ## Proposal @alyssatrinh **directory page actions** I also noticed that when users who don't have permission to modify a directory try to add a `New file` / `Upload file` / `New directory`, no messaging or alert is shown before the fork is created for users. This can be quite jarring, as users may go from trying to add something to a directory, to a fork being created (and potentially taking a long time) without any input or confirmation. We don't provide users a way to opt out of creating a fork from the directory pages. A modal may help in this situation as well. | Directory page: fork is created automatically | File page: users are shown message before forking | |-----------------------------------------------|---------------------------------------------------| | ![directory-newfile.mov](https://gitlab.com/-/project/278964/uploads/2dff8c7a90907d29c28c6c18844f0e45/directory-newfile.mov) | ![fork_suggestion_before.mov](https://gitlab.com/-/project/278964/uploads/97b68c16c70cc1f54513416164f23fa5/fork_suggestion_before.mov) | I would suggest going with a modal instead of an alert for the directory and file page actions that would prompt a user to fork a repo: * Directory page * `New file` * `Upload file` * `New directory` * File page * `Replace file` * `Delete` * `Edit` I also suggest simplifying the text so that we can use the same modal on the directory and file page: * **Fork to make changes** * You're not allowed to make changes to this project directly. Create a fork to make changes and submit a merge request. * `Cancel` `Fork` ## Scope Include ForkSuggestionModal for the actions in [AddToTree](https://gitlab.com/gitlab-org/gitlab/-/blob/d3cf7b34544d74e8bf25d99dd7a7fa3d5db4e548/app/assets/javascripts/repository/components/header_area/add_to_tree.vue) that result in forking the project before completing the action.
issue