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/experiments/application_experiment.rb')
-rw-r--r--app/experiments/application_experiment.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/experiments/application_experiment.rb b/app/experiments/application_experiment.rb
index 4ebf4a80498..0dd829e259e 100644
--- a/app/experiments/application_experiment.rb
+++ b/app/experiments/application_experiment.rb
@@ -12,17 +12,22 @@ class ApplicationExperiment < Gitlab::Experiment # rubocop:disable Gitlab/Namesp
def publish(_result = nil)
super
- publish_to_client if should_track? # publish the experiment data to the client
- publish_to_database if @record # publish the experiment context to the database
+ publish_to_client
+ publish_to_database
end
def publish_to_client
+ return unless should_track?
+
Gon.push({ experiment: { name => signature } }, true)
rescue NoMethodError
# means we're not in the request cycle, and can't add to Gon. Log a warning maybe?
end
def publish_to_database
+ return unless @record
+ return unless should_track?
+
# if the context contains a namespace, group, project, user, or actor
value = context.value
subject = value[:namespace] || value[:group] || value[:project] || value[:user] || value[:actor]