2014-04-02 08:38:24 -04:00
|
|
|
module Issues
|
2014-04-02 12:55:23 -04:00
|
|
|
class ReopenService < Issues::BaseService
|
2014-04-02 08:38:24 -04:00
|
|
|
def execute(issue)
|
2016-08-09 11:51:40 -04:00
|
|
|
return issue unless can?(current_user, :update_issue, issue)
|
|
|
|
|
2014-04-02 08:38:24 -04:00
|
|
|
if issue.reopen
|
|
|
|
event_service.reopen_issue(issue, current_user)
|
2014-04-02 08:50:50 -04:00
|
|
|
create_note(issue)
|
2014-07-03 06:51:24 -04:00
|
|
|
notification_service.reopen_issue(issue, current_user)
|
2014-05-23 09:16:03 -04:00
|
|
|
execute_hooks(issue, 'reopen')
|
2017-05-26 09:29:42 -04:00
|
|
|
invalidate_cache_counts(issue.assignees, issue)
|
2014-04-02 08:38:24 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
issue
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def create_note(issue)
|
2015-05-09 18:18:50 -04:00
|
|
|
SystemNoteService.change_status(issue, issue.project, current_user, issue.state, nil)
|
2014-04-02 08:38:24 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|