diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-23 03:09:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-23 03:09:09 +0300 |
commit | 5df6990daccf98d24f3ac45865d0386c3a4c3eb5 (patch) | |
tree | c2d2f2d59012d1dee0fadfdf6d321e0db23cbb9e /app/controllers | |
parent | b489f0f0a1ebcea2044911b7b38837f072b7ee05 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/ide_controller.rb | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/app/controllers/ide_controller.rb b/app/controllers/ide_controller.rb index ea67c76a8bc..1e254606b58 100644 --- a/app/controllers/ide_controller.rb +++ b/app/controllers/ide_controller.rb @@ -27,9 +27,20 @@ class IdeController < ApplicationController @branch = params[:branch] @path = params[:path] @merge_request = params[:merge_request_id] + @fork_info = fork_info(project, @branch) + end + + def fork_info(project, branch) + return if can?(current_user, :push_code, project) + + existing_fork = current_user.fork_of(project) - unless can?(current_user, :push_code, project) - @forked_project = ForkProjectsFinder.new(project, current_user: current_user).execute.first + if existing_fork + path = helpers.ide_edit_path(existing_fork, branch, '') + { ide_path: path } + elsif can?(current_user, :fork_project, project) + path = helpers.ide_fork_and_edit_path(project, branch, '', with_notice: false) + { fork_path: path } end end |