Class: Issues::ReopenService

Inherits:
BaseService show all
Defined in:
app/services/issues/reopen_service.rb

Constant Summary

Constants inherited from BaseService

BaseService::NO_REBALANCING_NEEDED

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 inherited from BaseService

#close_service, #hook_data, #rebalance_if_needed, #reopen_service

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

#execute(issue) ⇒ Object


5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/services/issues/reopen_service.rb', line 5

def execute(issue)
  return issue unless can?(current_user, :reopen_issue, issue)

  if issue.reopen
    event_service.reopen_issue(issue, current_user)
    create_note(issue, 'reopened')
    notification_service.async.reopen_issue(issue, current_user)
    execute_hooks(issue, 'reopen')
    invalidate_cache_counts(issue, users: issue.assignees)
    issue.update_project_counter_caches
    delete_milestone_closed_issue_counter_cache(issue.milestone)
    track_incident_action(current_user, issue, :incident_reopened)
  end

  issue
end