2014-09-02 18:07:02 +05:30
|
|
|
module Issues
|
|
|
|
class CloseService < Issues::BaseService
|
|
|
|
def execute(issue, commit = nil)
|
2015-12-23 02:04:40 +05:30
|
|
|
if project.jira_tracker? && project.jira_service.active
|
|
|
|
project.jira_service.execute(commit, issue)
|
|
|
|
return issue
|
|
|
|
end
|
|
|
|
|
2015-09-11 14:41:01 +05:30
|
|
|
if project.default_issues_tracker? && issue.close
|
2014-09-02 18:07:02 +05:30
|
|
|
event_service.close_issue(issue, current_user)
|
|
|
|
create_note(issue, commit)
|
2015-04-26 12:48:37 +05:30
|
|
|
notification_service.close_issue(issue, current_user)
|
2014-09-02 18:07:02 +05:30
|
|
|
execute_hooks(issue, 'close')
|
|
|
|
end
|
|
|
|
|
|
|
|
issue
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def create_note(issue, current_commit)
|
2015-09-11 14:41:01 +05:30
|
|
|
SystemNoteService.change_status(issue, issue.project, current_user, issue.state, current_commit)
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|