Class: Issues::BaseService

Inherits:
IssuableBaseService show all
Includes:
IncidentManagement::UsageData
Defined in:
app/services/issues/base_service.rb

Constant Summary collapse

NO_REBALANCING_NEEDED =
((RelativePositioning::MIN_POSITION * 0.9999)..(RelativePositioning::MAX_POSITION * 0.9999)).freeze

Constants included from Gitlab::Utils::UsageData

Gitlab::Utils::UsageData::FALLBACK

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods included from IncidentManagement::UsageData

#track_event, #track_incident_action

Methods included from Gitlab::Utils::UsageData

#alt_usage_data, #count, #distinct_count, #measure_duration, #redis_usage_data, #track_usage_event, #with_finished_at, #with_prometheus_client

Methods inherited from BaseService

#initialize

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?

Instance Method Details

#close_serviceObject


18
19
20
# File 'app/services/issues/base_service.rb', line 18

def close_service
  Issues::CloseService
end

#hook_data(issue, action, old_associations: {}) ⇒ Object


7
8
9
10
11
12
# File 'app/services/issues/base_service.rb', line 7

def hook_data(issue, action, old_associations: {})
  hook_data = issue.to_hook_data(current_user, old_associations: old_associations)
  hook_data[:object_attributes][:action] = action

  hook_data
end

#rebalance_if_needed(issue) ⇒ Object


24
25
26
27
28
29
30
31
32
33
# File 'app/services/issues/base_service.rb', line 24

def rebalance_if_needed(issue)
  return unless issue
  return if issue.relative_position.nil?
  return if NO_REBALANCING_NEEDED.cover?(issue.relative_position)

  gates = [issue.project, issue.project.group].compact
  return unless gates.any? { |gate| Feature.enabled?(:rebalance_issues, gate) }

  IssueRebalancingWorker.perform_async(nil, issue.project_id)
end

#reopen_serviceObject


14
15
16
# File 'app/services/issues/base_service.rb', line 14

def reopen_service
  Issues::ReopenService
end