Class: Issues::BaseService

Inherits:
IssuableBaseService show all
Extended by:
Gitlab::Utils::Override
Includes:
IncidentManagement::UsageData, IssueTypeHelpers
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::DISTRIBUTED_HLL_FALLBACK, Gitlab::Utils::UsageData::FALLBACK, Gitlab::Utils::UsageData::HISTOGRAM_FALLBACK, Gitlab::Utils::UsageData::MAX_BUCKET_SIZE

Instance Attribute Summary

Attributes inherited from BaseProjectService

#project

Attributes inherited from BaseContainerService

#container, #current_user, #params

Instance Method Summary collapse

Methods included from Gitlab::Utils::Override

extended, extensions, included, method_added, override, prepended, queue_verification, verify!

Methods included from IssueTypeHelpers

#create_issue_type_allowed?

Methods included from IncidentManagement::UsageData

#track_incident_action

Methods included from Gitlab::Utils::UsageData

#add, #add_metric, #alt_usage_data, #count, #distinct_count, #epics_deepest_relationship_level, #estimate_batch_distinct_count, #histogram, #jira_integration_data, #maximum_id, #measure_duration, #minimum_id, #redis_usage_data, #sum, #track_usage_event, #with_duration, #with_finished_at, #with_prometheus_client

Methods included from Gitlab::Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Methods inherited from BaseProjectService

#initialize

Methods inherited from BaseContainerService

#group_container?, #initialize, #namespace_container?, #project_container?

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


20
21
22
# File 'app/services/issues/base_service.rb', line 20

def close_service
  Issues::CloseService
end

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


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

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


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

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) }

  Issues::RebalancingWorker.perform_async(nil, *issue.project.self_or_root_group_ids)
end

#reopen_serviceObject


16
17
18
# File 'app/services/issues/base_service.rb', line 16

def reopen_service
  Issues::ReopenService
end