2014-09-02 18:07:02 +05:30
|
|
|
module MergeRequests
|
|
|
|
class CloseService < MergeRequests::BaseService
|
|
|
|
def execute(merge_request, commit = nil)
|
2016-09-13 17:45:13 +05:30
|
|
|
return merge_request unless can?(current_user, :update_merge_request, merge_request)
|
|
|
|
|
2014-09-02 18:07:02 +05:30
|
|
|
# If we close MergeRequest we want to ignore validation
|
|
|
|
# so we can close broken one (Ex. fork project removed)
|
|
|
|
merge_request.allow_broken = true
|
|
|
|
|
|
|
|
if merge_request.close
|
|
|
|
event_service.close_mr(merge_request, current_user)
|
|
|
|
create_note(merge_request)
|
2015-04-26 12:48:37 +05:30
|
|
|
notification_service.close_mr(merge_request, current_user)
|
2016-04-02 18:10:28 +05:30
|
|
|
todo_service.close_merge_request(merge_request, current_user)
|
2015-04-26 12:48:37 +05:30
|
|
|
execute_hooks(merge_request, 'close')
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
merge_request
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|