gitlab-org--gitlab-foss/app/services/issues/reopen_service.rb
Sean McGivern 0e488ef70a Clear issuable counter caches on update
When an issuable's state changes, or one is created, we should clear the cache
counts for a user's assigned issuables, and also the project-wide caches for
this user type.
2017-07-19 10:21:20 +01:00

23 lines
601 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)
notification_service.reopen_issue(issue, current_user)
execute_hooks(issue, 'reopen')
invalidate_cache_counts(issue, users: issue.assignees)
end
issue
end
private
def create_note(issue)
SystemNoteService.change_status(issue, issue.project, current_user, issue.state, nil)
end
end
end