gitlab-org--gitlab-foss/app/services/issues/update_service.rb
Dmitriy Zaporozhets 84b5d0356a
Refactor similar code for Issue and MR update service
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-11-17 12:42:43 +01:00

30 lines
690 B
Ruby

module Issues
class UpdateService < Issues::BaseService
def execute(issue)
update(issue)
end
def handle_changes(issue)
if issue.previous_changes.include?('milestone_id')
create_milestone_note(issue)
end
if issue.previous_changes.include?('assignee_id')
create_assignee_note(issue)
notification_service.reassigned_issue(issue, current_user)
end
if issue.previous_changes.include?('title')
create_title_change_note(issue, issue.previous_changes['title'].first)
end
end
def reopen_service
Issues::ReopenService
end
def close_service
Issues::CloseService
end
end
end