diff options
author | Rémy Coutable <remy@rymai.me> | 2017-09-15 19:08:27 +0200 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-10-09 15:07:10 +0200 |
commit | 67d5ca9f9220e5572f3fa6d0d8290cd7b802f02f (patch) | |
tree | d424fc71d20847c8a7c0314ff081f3d2ed9afbe4 /app/models | |
parent | f277fa14094e5515e2317d2baa1fa0bfb95966da (diff) | |
download | gitlab-ce-67d5ca9f9220e5572f3fa6d0d8290cd7b802f02f.tar.gz |
Include the changes in issuable webhook payloads
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/concerns/issuable.rb | 8 | ||||
-rw-r--r-- | app/models/issue.rb | 1 | ||||
-rw-r--r-- | app/models/merge_request.rb | 1 |
3 files changed, 9 insertions, 1 deletions
diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb index fc30d008dea..e8a6c37d0b9 100644 --- a/app/models/concerns/issuable.rb +++ b/app/models/concerns/issuable.rb @@ -256,13 +256,19 @@ module Issuable participants(user).include?(user) end - def to_hook_data(user) + def to_hook_data(user, old_labels: []) + changes = previous_changes + if old_labels != labels + changes[:labels] = [old_labels.map(&:name), labels.map(&:name)] + end + hook_data = { object_kind: self.class.name.underscore, user: user.hook_attrs, project: project.hook_attrs, object_attributes: hook_attrs, labels: labels.map(&:hook_attrs), + changes: changes, # DEPRECATED repository: project.hook_attrs.slice(:name, :url, :description, :homepage) } diff --git a/app/models/issue.rb b/app/models/issue.rb index 155c5d972b7..058ee144ee4 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -78,6 +78,7 @@ class Issue < ActiveRecord::Base assignee_ids = self.assignee_ids attrs = { + url: Gitlab::UrlBuilder.build(self), total_time_spent: total_time_spent, human_total_time_spent: human_total_time_spent, human_time_estimate: human_time_estimate, diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 292122f779e..52a6c31503a 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -589,6 +589,7 @@ class MergeRequest < ActiveRecord::Base def hook_attrs attrs = { + url: Gitlab::UrlBuilder.build(self), source: source_project.try(:hook_attrs), target: target_project.hook_attrs, last_commit: nil, |