2014-09-02 18:07:02 +05:30
|
|
|
module Issues
|
|
|
|
class UpdateService < Issues::BaseService
|
|
|
|
def execute(issue)
|
2015-12-23 02:04:40 +05:30
|
|
|
update(issue)
|
2015-11-26 14:37:03 +05:30
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
def handle_changes(issue, old_labels: [])
|
|
|
|
if has_changes?(issue, old_labels: old_labels)
|
2016-04-02 18:10:28 +05:30
|
|
|
todo_service.mark_pending_todos_as_done(issue, current_user)
|
|
|
|
end
|
|
|
|
|
|
|
|
if issue.previous_changes.include?('title') ||
|
|
|
|
issue.previous_changes.include?('description')
|
|
|
|
todo_service.update_issue(issue, current_user)
|
|
|
|
end
|
|
|
|
|
2015-11-26 14:37:03 +05:30
|
|
|
if issue.previous_changes.include?('milestone_id')
|
|
|
|
create_milestone_note(issue)
|
|
|
|
end
|
2015-09-11 14:41:01 +05:30
|
|
|
|
2015-11-26 14:37:03 +05:30
|
|
|
if issue.previous_changes.include?('assignee_id')
|
|
|
|
create_assignee_note(issue)
|
|
|
|
notification_service.reassigned_issue(issue, current_user)
|
2016-04-02 18:10:28 +05:30
|
|
|
todo_service.reassigned_issue(issue, current_user)
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
2016-06-02 11:05:42 +05:30
|
|
|
|
|
|
|
if issue.previous_changes.include?('confidential')
|
|
|
|
create_confidentiality_note(issue)
|
|
|
|
end
|
|
|
|
|
|
|
|
added_labels = issue.labels - old_labels
|
|
|
|
if added_labels.present?
|
|
|
|
notification_service.relabeled_issue(issue, added_labels, current_user)
|
|
|
|
end
|
2015-12-23 02:04:40 +05:30
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
|
2015-12-23 02:04:40 +05:30
|
|
|
def reopen_service
|
|
|
|
Issues::ReopenService
|
|
|
|
end
|
|
|
|
|
|
|
|
def close_service
|
|
|
|
Issues::CloseService
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
2016-06-02 11:05:42 +05:30
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def create_confidentiality_note(issue)
|
|
|
|
SystemNoteService.change_issue_confidentiality(issue, issue.project, current_user)
|
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|