2014-09-02 18:07:02 +05:30
|
|
|
module MergeRequests
|
2015-04-26 12:48:37 +05:30
|
|
|
class BaseService < ::IssuableBaseService
|
2014-09-02 18:07:02 +05:30
|
|
|
|
|
|
|
def create_note(merge_request)
|
|
|
|
Note.create_status_change_note(merge_request, merge_request.target_project, current_user, merge_request.state, nil)
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
def hook_data(merge_request, action)
|
|
|
|
hook_data = merge_request.to_hook_data(current_user)
|
|
|
|
merge_request_url = Gitlab::UrlBuilder.new(:merge_request).build(merge_request.id)
|
|
|
|
hook_data[:object_attributes][:url] = merge_request_url
|
|
|
|
hook_data[:object_attributes][:action] = action
|
|
|
|
hook_data
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
def execute_hooks(merge_request, action = 'open')
|
|
|
|
if merge_request.project
|
|
|
|
merge_data = hook_data(merge_request, action)
|
|
|
|
merge_request.project.execute_hooks(merge_data, :merge_request_hooks)
|
|
|
|
merge_request.project.execute_services(merge_data, :merge_request_hooks)
|
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|