summaryrefslogtreecommitdiff
path: root/app/controllers/projects/blob_controller.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-05-12 12:10:24 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-05-12 12:10:24 +0000
commit71a67d17b02e7b8dec2f4c257f6734dc7818fb1e (patch)
tree6b45633257869a67fd534bd2cf899b93a48794c0 /app/controllers/projects/blob_controller.rb
parent133ec9237af290062aae70e6f115db69b51c88de (diff)
downloadgitlab-ce-71a67d17b02e7b8dec2f4c257f6734dc7818fb1e.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers/projects/blob_controller.rb')
-rw-r--r--app/controllers/projects/blob_controller.rb17
1 files changed, 16 insertions, 1 deletions
diff --git a/app/controllers/projects/blob_controller.rb b/app/controllers/projects/blob_controller.rb
index cbee33853bb..dbe628cb43a 100644
--- a/app/controllers/projects/blob_controller.rb
+++ b/app/controllers/projects/blob_controller.rb
@@ -31,6 +31,7 @@ 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 :track_experiment, only: :create
track_redis_hll_event :create, :update, name: 'g_edit_by_sfe'
@@ -46,7 +47,7 @@ class Projects::BlobController < Projects::ApplicationController
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
@@ -264,4 +265,18 @@ class Projects::BlobController < Projects::ApplicationController
def visitor_id
current_user&.id
end
+
+ 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]
+
+ experiment(:code_quality_walkthrough, namespace: @project.root_ancestor).track(:commit_created)
+ end
end