summaryrefslogtreecommitdiff
path: root/lib/api/helpers.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r--lib/api/helpers.rb22
1 files changed, 6 insertions, 16 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index 9db4a03c5b9..2d8a4f60e2a 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -3,6 +3,7 @@
module API
module Helpers
include Gitlab::Utils
+ include Helpers::Caching
include Helpers::Pagination
include Helpers::PaginationStrategies
@@ -48,7 +49,11 @@ module API
# Returns the job associated with the token provided for
# authentication, if any
def current_authenticated_job
- @current_authenticated_job
+ if try(:namespace_inheritable, :authentication)
+ ci_build_from_namespace_inheritable
+ else
+ @current_authenticated_job # rubocop:disable Gitlab/ModuleWithInstanceVariables
+ end
end
# rubocop:disable Gitlab/ModuleWithInstanceVariables
@@ -539,17 +544,6 @@ module API
end
end
- def track_event(action = action_name, **args)
- category = args.delete(:category) || self.options[:for].name
- raise "invalid category" unless category
-
- ::Gitlab::Tracking.event(category, action.to_s, **args)
- rescue => error
- Gitlab::AppLogger.warn(
- "Tracking event failed for action: #{action}, category: #{category}, message: #{error.message}"
- )
- end
-
def increment_counter(event_name)
feature_name = "usage_data_#{event_name}"
return unless Feature.enabled?(feature_name)
@@ -564,10 +558,6 @@ module API
def increment_unique_values(event_name, values)
return unless values.present?
- feature_flag = "usage_data_#{event_name}"
-
- return unless Feature.enabled?(feature_flag, default_enabled: true)
-
Gitlab::UsageDataCounters::HLLRedisCounter.track_event(event_name, values: values)
rescue => error
Gitlab::AppLogger.warn("Redis tracking event failed for event: #{event_name}, message: #{error.message}")