diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-16 18:18:33 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-16 18:18:33 +0000 |
commit | f64a639bcfa1fc2bc89ca7db268f594306edfd7c (patch) | |
tree | a2c3c2ebcc3b45e596949db485d6ed18ffaacfa1 /app/controllers/ide_controller.rb | |
parent | bfbc3e0d6583ea1a91f627528bedc3d65ba4b10f (diff) | |
download | gitlab-ce-f64a639bcfa1fc2bc89ca7db268f594306edfd7c.tar.gz |
Add latest changes from gitlab-org/gitlab@13-10-stable-eev13.10.0-rc40
Diffstat (limited to 'app/controllers/ide_controller.rb')
-rw-r--r-- | app/controllers/ide_controller.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/app/controllers/ide_controller.rb b/app/controllers/ide_controller.rb index 8c0414ad5da..ea67c76a8bc 100644 --- a/app/controllers/ide_controller.rb +++ b/app/controllers/ide_controller.rb @@ -5,10 +5,12 @@ class IdeController < ApplicationController include ClientsidePreviewCSP include StaticObjectExternalStorageCSP + include Gitlab::Utils::StrongMemoize before_action do push_frontend_feature_flag(:build_service_proxy) push_frontend_feature_flag(:schema_linting) + define_index_vars end feature_category :web_ide @@ -16,4 +18,26 @@ class IdeController < ApplicationController def index Gitlab::UsageDataCounters::WebIdeCounter.increment_views_count end + + private + + def define_index_vars + return unless project + + @branch = params[:branch] + @path = params[:path] + @merge_request = params[:merge_request_id] + + unless can?(current_user, :push_code, project) + @forked_project = ForkProjectsFinder.new(project, current_user: current_user).execute.first + end + end + + def project + strong_memoize(:project) do + next unless params[:project_id].present? + + Project.find_by_full_path(params[:project_id]) + end + end end |