Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-03-23 03:09:09 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-03-23 03:09:09 +0300
commit5df6990daccf98d24f3ac45865d0386c3a4c3eb5 (patch)
treec2d2f2d59012d1dee0fadfdf6d321e0db23cbb9e /app/controllers
parentb489f0f0a1ebcea2044911b7b38837f072b7ee05 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/ide_controller.rb15
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