summaryrefslogtreecommitdiff
path: root/app/services
diff options
context:
space:
mode:
authorjubianchi <contact@jubianchi.fr>2015-01-18 01:34:34 +0100
committerjubianchi <contact@jubianchi.fr>2015-01-20 10:50:24 +0100
commit4ffdb83e713b1ffa9578c02d31cfd0d9afe56ca7 (patch)
treec1277e89d305685e1d78b71067a8708d94e1c6fe /app/services
parentb1c79eaf945b22602552edf8d111c5245057bad2 (diff)
downloadgitlab-ce-4ffdb83e713b1ffa9578c02d31cfd0d9afe56ca7.tar.gz
Add action property to merge request hook
Diffstat (limited to 'app/services')
-rw-r--r--app/services/merge_requests/base_service.rb5
-rw-r--r--app/services/merge_requests/close_service.rb2
-rw-r--r--app/services/merge_requests/merge_service.rb2
-rw-r--r--app/services/merge_requests/reopen_service.rb2
-rw-r--r--app/services/merge_requests/update_service.rb2
5 files changed, 8 insertions, 5 deletions
diff --git a/app/services/merge_requests/base_service.rb b/app/services/merge_requests/base_service.rb
index 7f3421b8e4b..b4199d1c800 100644
--- a/app/services/merge_requests/base_service.rb
+++ b/app/services/merge_requests/base_service.rb
@@ -5,9 +5,12 @@ module MergeRequests
Note.create_status_change_note(merge_request, merge_request.target_project, current_user, merge_request.state, nil)
end
- def execute_hooks(merge_request)
+ def execute_hooks(merge_request, action = 'open')
if merge_request.project
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
merge_request.project.execute_hooks(hook_data, :merge_request_hooks)
end
end
diff --git a/app/services/merge_requests/close_service.rb b/app/services/merge_requests/close_service.rb
index 64e37a23e6b..4249a84f382 100644
--- a/app/services/merge_requests/close_service.rb
+++ b/app/services/merge_requests/close_service.rb
@@ -9,7 +9,7 @@ module MergeRequests
event_service.close_mr(merge_request, current_user)
notification_service.close_mr(merge_request, current_user)
create_note(merge_request)
- execute_hooks(merge_request)
+ execute_hooks(merge_request, 'close')
end
merge_request
diff --git a/app/services/merge_requests/merge_service.rb b/app/services/merge_requests/merge_service.rb
index 5de7247d617..1e1614028f7 100644
--- a/app/services/merge_requests/merge_service.rb
+++ b/app/services/merge_requests/merge_service.rb
@@ -12,7 +12,7 @@ module MergeRequests
notification_service.merge_mr(merge_request, current_user)
create_merge_event(merge_request, current_user)
create_note(merge_request)
- execute_hooks(merge_request)
+ execute_hooks(merge_request, 'merge')
true
rescue
diff --git a/app/services/merge_requests/reopen_service.rb b/app/services/merge_requests/reopen_service.rb
index bd68919a550..a2a9c933f63 100644
--- a/app/services/merge_requests/reopen_service.rb
+++ b/app/services/merge_requests/reopen_service.rb
@@ -5,7 +5,7 @@ module MergeRequests
event_service.reopen_mr(merge_request, current_user)
notification_service.reopen_mr(merge_request, current_user)
create_note(merge_request)
- execute_hooks(merge_request)
+ execute_hooks(merge_request, 'reopen')
merge_request.reload_code
merge_request.mark_as_unchecked
end
diff --git a/app/services/merge_requests/update_service.rb b/app/services/merge_requests/update_service.rb
index fc26619cd17..56c8510e0ae 100644
--- a/app/services/merge_requests/update_service.rb
+++ b/app/services/merge_requests/update_service.rb
@@ -38,7 +38,7 @@ module MergeRequests
end
merge_request.notice_added_references(merge_request.project, current_user)
- execute_hooks(merge_request)
+ execute_hooks(merge_request, 'update')
end
merge_request