diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-23 12:08:49 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-23 12:08:49 +0300 |
commit | 00a889ea7a115ebbda95a071dd630f93b79261e3 (patch) | |
tree | 25afde9634fcee21f763fed8934480ced47abcad /app/services/service_ping | |
parent | d950ea420a77bc6b27037bd00484f2463e79b4fd (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/service_ping')
-rw-r--r-- | app/services/service_ping/permit_data_categories_service.rb | 12 | ||||
-rw-r--r-- | app/services/service_ping/service_ping_settings.rb | 19 | ||||
-rw-r--r-- | app/services/service_ping/submit_service.rb | 2 |
3 files changed, 21 insertions, 12 deletions
diff --git a/app/services/service_ping/permit_data_categories_service.rb b/app/services/service_ping/permit_data_categories_service.rb index ff48c022b56..49dd2426262 100644 --- a/app/services/service_ping/permit_data_categories_service.rb +++ b/app/services/service_ping/permit_data_categories_service.rb @@ -14,20 +14,10 @@ module ServicePing ].to_set.freeze def execute - return [] unless product_intelligence_enabled? + return [] unless ServicePingSettings.product_intelligence_enabled? CATEGORIES end - - def product_intelligence_enabled? - pings_enabled? && !User.single_user&.requires_usage_stats_consent? - end - - private - - def pings_enabled? - ::Gitlab::CurrentSettings.usage_ping_enabled? - end end end diff --git a/app/services/service_ping/service_ping_settings.rb b/app/services/service_ping/service_ping_settings.rb new file mode 100644 index 00000000000..2b6535d89d1 --- /dev/null +++ b/app/services/service_ping/service_ping_settings.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module ServicePing + module ServicePingSettings + extend self + + def product_intelligence_enabled? + pings_enabled? && !User.single_user&.requires_usage_stats_consent? + end + + private + + def pings_enabled? + ::Gitlab::CurrentSettings.usage_ping_enabled? + end + end +end + +ServicePing::ServicePingSettings.extend_mod_with('ServicePing::ServicePingSettings') diff --git a/app/services/service_ping/submit_service.rb b/app/services/service_ping/submit_service.rb index 5c03aa46e18..09d1670fd1f 100644 --- a/app/services/service_ping/submit_service.rb +++ b/app/services/service_ping/submit_service.rb @@ -18,7 +18,7 @@ module ServicePing SubmissionError = Class.new(StandardError) def execute - return unless ServicePing::PermitDataCategoriesService.new.product_intelligence_enabled? + return unless ServicePing::ServicePingSettings.product_intelligence_enabled? begin usage_data = BuildPayloadService.new.execute |