2014-04-02 08:38:24 -04:00
|
|
|
module Issues
|
2014-04-02 12:55:23 -04:00
|
|
|
class CloseService < Issues::BaseService
|
2014-04-02 08:38:24 -04:00
|
|
|
def execute(issue, commit = nil)
|
2015-12-17 17:08:14 -05:00
|
|
|
if project.jira_tracker? && project.jira_service.active
|
|
|
|
project.jira_service.execute(commit, issue)
|
2016-02-16 15:31:40 -05:00
|
|
|
task_service.close_issue(issue, current_user)
|
2015-12-17 17:08:14 -05:00
|
|
|
return issue
|
|
|
|
end
|
|
|
|
|
2015-06-12 01:39:50 -04:00
|
|
|
if project.default_issues_tracker? && issue.close
|
2014-04-02 08:38:24 -04:00
|
|
|
event_service.close_issue(issue, current_user)
|
|
|
|
create_note(issue, commit)
|
2015-01-26 01:49:05 -05:00
|
|
|
notification_service.close_issue(issue, current_user)
|
2016-02-16 15:31:40 -05:00
|
|
|
task_service.close_issue(issue, current_user)
|
2014-05-23 09:16:03 -04:00
|
|
|
execute_hooks(issue, 'close')
|
2014-04-02 08:38:24 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
issue
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def create_note(issue, current_commit)
|
2015-05-09 18:18:50 -04:00
|
|
|
SystemNoteService.change_status(issue, issue.project, current_user, issue.state, current_commit)
|
2014-04-02 08:38:24 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|