gitlab-org--gitlab-foss/app/services/merge_requests/reopen_service.rb
Rémy Coutable a54fdc384f Enforce permissions in {Issues,MergeRequests}::{Close,Reopen}Service
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-08-13 00:06:11 +02:00

18 lines
559 B
Ruby

module MergeRequests
class ReopenService < MergeRequests::BaseService
def execute(merge_request)
return merge_request unless can?(current_user, :update_merge_request, merge_request)
if merge_request.reopen
event_service.reopen_mr(merge_request, current_user)
create_note(merge_request)
notification_service.reopen_mr(merge_request, current_user)
execute_hooks(merge_request, 'reopen')
merge_request.reload_diff
merge_request.mark_as_unchecked
end
merge_request
end
end
end