debian-mirror-gitlab/app/services/issues/reopen_service.rb
2018-10-15 14:42:47 +05:30

24 lines
678 B
Ruby

module Issues
class ReopenService < Issues::BaseService
def execute(issue)
return issue unless can?(current_user, :update_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
end
issue
end
private
def create_note(issue, state = issue.state)
SystemNoteService.change_status(issue, issue.project, current_user, state, nil)
end
end
end