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:
Diffstat (limited to 'app/controllers/projects/blob_controller.rb')
-rw-r--r--app/controllers/projects/blob_controller.rb24
1 files changed, 18 insertions, 6 deletions
diff --git a/app/controllers/projects/blob_controller.rb b/app/controllers/projects/blob_controller.rb
index a398fc56a35..dbe628cb43a 100644
--- a/app/controllers/projects/blob_controller.rb
+++ b/app/controllers/projects/blob_controller.rb
@@ -31,19 +31,23 @@ class Projects::BlobController < Projects::ApplicationController
before_action :editor_variables, except: [:show, :preview, :diff]
before_action :validate_diff_params, only: :diff
before_action :set_last_commit_sha, only: [:edit, :update]
- before_action :record_experiment, only: :new
+ before_action :track_experiment, only: :create
track_redis_hll_event :create, :update, name: 'g_edit_by_sfe'
feature_category :source_code_management
+ before_action do
+ push_frontend_feature_flag(:refactor_blob_viewer, @project, default_enabled: :yaml)
+ end
+
def new
commit unless @repository.empty?
end
def create
create_commit(Files::CreateService, success_notice: _("The file has been successfully created."),
- success_path: -> { project_blob_path(@project, File.join(@branch_name, @file_path)) },
+ success_path: -> { create_success_path },
failure_view: :new,
failure_path: project_new_blob_path(@project, @ref))
end
@@ -214,7 +218,7 @@ class Projects::BlobController < Projects::ApplicationController
def show_html
environment_params = @repository.branch_exists?(@ref) ? { ref: @ref } : { commit: @commit }
environment_params[:find_latest] = true
- @environment = EnvironmentsByDeploymentsFinder.new(@project, current_user, environment_params).execute.last
+ @environment = ::Environments::EnvironmentsByDeploymentsFinder.new(@project, current_user, environment_params).execute.last
@last_commit = @repository.last_commit_for_path(@commit.id, @blob.path, literal_pathspec: true)
@code_navigation_path = Gitlab::CodeNavigationPath.new(@project, @blob.commit_id).full_json_path_for(@blob.path)
@@ -262,9 +266,17 @@ class Projects::BlobController < Projects::ApplicationController
current_user&.id
end
- def record_experiment
- return unless params[:file_name] == @project.ci_config_path_or_default && @project.namespace.recent?
+ def create_success_path
+ if params[:code_quality_walkthrough]
+ project_pipelines_path(@project, code_quality_walkthrough: true)
+ else
+ project_blob_path(@project, File.join(@branch_name, @file_path))
+ end
+ end
+
+ def track_experiment
+ return unless params[:code_quality_walkthrough]
- record_experiment_user(:ci_syntax_templates_b, namespace_id: @project.namespace_id)
+ experiment(:code_quality_walkthrough, namespace: @project.root_ancestor).track(:commit_created)
end
end