summaryrefslogtreecommitdiff
path: root/app/controllers/ide_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/ide_controller.rb')
-rw-r--r--app/controllers/ide_controller.rb16
1 files changed, 14 insertions, 2 deletions
diff --git a/app/controllers/ide_controller.rb b/app/controllers/ide_controller.rb
index ea67c76a8bc..4c7a91ee602 100644
--- a/app/controllers/ide_controller.rb
+++ b/app/controllers/ide_controller.rb
@@ -10,6 +10,7 @@ class IdeController < ApplicationController
before_action do
push_frontend_feature_flag(:build_service_proxy)
push_frontend_feature_flag(:schema_linting)
+ push_frontend_feature_flag(:reject_unsigned_commits_by_gitlab, default_enabled: :yaml)
define_index_vars
end
@@ -27,9 +28,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