diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-10 06:08:03 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-10 06:08:03 +0300 |
commit | f5ae9d0960aa422a65a2a22e230100257dddb9ed (patch) | |
tree | 7ececb6a6806b3599d16cbafe07ecd0b194e2604 /lib | |
parent | 9ac561230fb7a94c8f8e35163fe47fdb9829b108 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/experimentation.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/gitlab/experimentation.rb b/lib/gitlab/experimentation.rb index 7c59267c0b6..30c8eaf605a 100644 --- a/lib/gitlab/experimentation.rb +++ b/lib/gitlab/experimentation.rb @@ -40,7 +40,7 @@ module Gitlab extend ActiveSupport::Concern included do - before_action :set_experimentation_subject_id_cookie + before_action :set_experimentation_subject_id_cookie, unless: :dnt_enabled? helper_method :experiment_enabled? end @@ -56,7 +56,12 @@ module Gitlab end def experiment_enabled?(experiment_key) - Experimentation.enabled_for_user?(experiment_key, experimentation_subject_index) || forced_enabled?(experiment_key) + return false if dnt_enabled? + + return true if Experimentation.enabled_for_user?(experiment_key, experimentation_subject_index) + return true if forced_enabled?(experiment_key) + + false end def track_experiment_event(experiment_key, action, value = nil) @@ -73,6 +78,10 @@ module Gitlab private + def dnt_enabled? + Gitlab::Utils.to_boolean(request.headers['DNT']) + end + def experimentation_subject_id cookies.signed[:experimentation_subject_id] end |