Class: Gitlab::Organizations::FallbackOrganizationTracker

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/organizations/fallback_organization_tracker.rb

Class Method Summary collapse

Class Method Details

.disableObject



18
19
20
# File 'lib/gitlab/organizations/fallback_organization_tracker.rb', line 18

def self.disable
  set(false)
end

.enableObject



14
15
16
# File 'lib/gitlab/organizations/fallback_organization_tracker.rb', line 14

def self.enable
  set(true)
end

.enabled?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/gitlab/organizations/fallback_organization_tracker.rb', line 22

def self.enabled?
  current_value == true
end

.triggerObject



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/gitlab/organizations/fallback_organization_tracker.rb', line 26

def self.trigger
  return unless enabled? && Feature.enabled?(:track_organization_fallback, Feature.current_request)

  Gitlab::InternalEvents.track_event(
    'fallback_current_organization_to_default',
    category: 'Organizations',
    additional_properties: {
      label: Gitlab::ApplicationContext.current_context_attribute(:caller_id)
    }
  )
end

.without_trackingObject



6
7
8
9
10
11
12
# File 'lib/gitlab/organizations/fallback_organization_tracker.rb', line 6

def self.without_tracking
  previous_value = current_value
  disable
  yield
ensure
  set(previous_value)
end