Skip to content
Snippets Groups Projects
Verified Commit f2be76f3 authored by Luke "Jared" Bennett's avatar Luke "Jared" Bennett
Browse files

Added labels to the issue web hook

parent 4a81867d
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -261,6 +261,7 @@ module Issuable
user: user.hook_attrs,
project: project.hook_attrs,
object_attributes: hook_attrs,
labels: labels.map(&:hook_attrs),
# DEPRECATED
repository: project.hook_attrs.slice(:name, :url, :description, :homepage)
}
Loading
Loading
Loading
Loading
@@ -169,6 +169,10 @@ class Label < ActiveRecord::Base
end
end
 
def hook_attrs
attributes
end
private
 
def issues_count(user, params = {})
Loading
Loading
---
title: Added labels array to the issue web hook returned object
merge_request: 9972
author:
Loading
Loading
@@ -250,7 +250,19 @@ X-Gitlab-Event: Issue Hook
"name": "User1",
"username": "user1",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon"
}
},
"labels": [{
"id": 206,
"title": "API",
"color": "#ffffff",
"project_id": 14,
"created_at": "2013-12-03T17:15:43Z",
"updated_at": "2013-12-03T17:15:43Z",
"template": false,
"description": "API related issues",
"type": "ProjectLabel",
"group_id": 41
}]
}
```
### Comment events
Loading
Loading
Loading
Loading
@@ -278,6 +278,16 @@ describe Issue, "Issuable" do
end
end
 
context 'issue has labels' do
let(:labels) { [create(:label), create(:label)] }
before { issue.update_attribute(:labels, labels)}
it 'includes labels in the hook data' do
expect(data[:labels]).to eq(labels.map(&:hook_attrs))
end
end
include_examples 'project hook data'
include_examples 'deprecated repository hook data'
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment