Commit 20844326 authored by Jean-Baptiste Guerraz's avatar Jean-Baptiste Guerraz

align "confidential issues events" implementation with "issues events" one

parent bac9bb18
...@@ -1194,6 +1194,7 @@ GET /projects/:id/hooks/:hook_id ...@@ -1194,6 +1194,7 @@ GET /projects/:id/hooks/:hook_id
"project_id": 3, "project_id": 3,
"push_events": true, "push_events": true,
"issues_events": true, "issues_events": true,
"confidential_issues_events": true,
"merge_requests_events": true, "merge_requests_events": true,
"tag_push_events": true, "tag_push_events": true,
"note_events": true, "note_events": true,
...@@ -1219,6 +1220,7 @@ POST /projects/:id/hooks ...@@ -1219,6 +1220,7 @@ POST /projects/:id/hooks
| `url` | string | yes | The hook URL | | `url` | string | yes | The hook URL |
| `push_events` | boolean | no | Trigger hook on push events | | `push_events` | boolean | no | Trigger hook on push events |
| `issues_events` | boolean | no | Trigger hook on issues events | | `issues_events` | boolean | no | Trigger hook on issues events |
| `confidential_issues_events` | boolean | no | Trigger hook on confidential issues events |
| `merge_requests_events` | boolean | no | Trigger hook on merge requests events | | `merge_requests_events` | boolean | no | Trigger hook on merge requests events |
| `tag_push_events` | boolean | no | Trigger hook on tag push events | | `tag_push_events` | boolean | no | Trigger hook on tag push events |
| `note_events` | boolean | no | Trigger hook on note events | | `note_events` | boolean | no | Trigger hook on note events |
...@@ -1243,6 +1245,7 @@ PUT /projects/:id/hooks/:hook_id ...@@ -1243,6 +1245,7 @@ PUT /projects/:id/hooks/:hook_id
| `url` | string | yes | The hook URL | | `url` | string | yes | The hook URL |
| `push_events` | boolean | no | Trigger hook on push events | | `push_events` | boolean | no | Trigger hook on push events |
| `issues_events` | boolean | no | Trigger hook on issues events | | `issues_events` | boolean | no | Trigger hook on issues events |
| `confidential_issues_events` | boolean | no | Trigger hook on confidential issues events |
| `merge_requests_events` | boolean | no | Trigger hook on merge requests events | | `merge_requests_events` | boolean | no | Trigger hook on merge requests events |
| `tag_push_events` | boolean | no | Trigger hook on tag push events | | `tag_push_events` | boolean | no | Trigger hook on tag push events |
| `note_events` | boolean | no | Trigger hook on note events | | `note_events` | boolean | no | Trigger hook on note events |
......
...@@ -619,6 +619,7 @@ Example response: ...@@ -619,6 +619,7 @@ Example response:
"active": true, "active": true,
"push_events": true, "push_events": true,
"issues_events": true, "issues_events": true,
"confidential_issues_events": true,
"merge_requests_events": true, "merge_requests_events": true,
"tag_push_events": true, "tag_push_events": true,
"note_events": true, "note_events": true,
......
...@@ -71,7 +71,7 @@ module API ...@@ -71,7 +71,7 @@ module API
end end
class ProjectHook < Hook class ProjectHook < Hook
expose :project_id, :issues_events expose :project_id, :issues_events, :confidential_issues_events
expose :note_events, :pipeline_events, :wiki_page_events expose :note_events, :pipeline_events, :wiki_page_events
expose :job_events expose :job_events
end end
......
...@@ -10,6 +10,7 @@ module API ...@@ -10,6 +10,7 @@ module API
requires :url, type: String, desc: "The URL to send the request to" requires :url, type: String, desc: "The URL to send the request to"
optional :push_events, type: Boolean, desc: "Trigger hook on push events" optional :push_events, type: Boolean, desc: "Trigger hook on push events"
optional :issues_events, type: Boolean, desc: "Trigger hook on issues events" optional :issues_events, type: Boolean, desc: "Trigger hook on issues events"
optional :confidential_issues_events, type: Boolean, desc: "Trigger hook on confidential issues events"
optional :merge_requests_events, type: Boolean, desc: "Trigger hook on merge request events" optional :merge_requests_events, type: Boolean, desc: "Trigger hook on merge request events"
optional :tag_push_events, type: Boolean, desc: "Trigger hook on tag push events" optional :tag_push_events, type: Boolean, desc: "Trigger hook on tag push events"
optional :note_events, type: Boolean, desc: "Trigger hook on note(comment) events" optional :note_events, type: Boolean, desc: "Trigger hook on note(comment) events"
......
...@@ -252,8 +252,9 @@ module API ...@@ -252,8 +252,9 @@ module API
class ProjectService < Grape::Entity class ProjectService < Grape::Entity
expose :id, :title, :created_at, :updated_at, :active expose :id, :title, :created_at, :updated_at, :active
expose :push_events, :issues_events, :merge_requests_events expose :push_events, :issues_events, :confidential_issues_events
expose :tag_push_events, :note_events, :pipeline_events expose :merge_requests_events, :tag_push_events, :note_events
expose :pipeline_events
expose :job_events, as: :build_events expose :job_events, as: :build_events
# Expose serialized properties # Expose serialized properties
expose :properties do |service, options| expose :properties do |service, options|
...@@ -262,8 +263,9 @@ module API ...@@ -262,8 +263,9 @@ module API
end end
class ProjectHook < ::API::Entities::Hook class ProjectHook < ::API::Entities::Hook
expose :project_id, :issues_events, :merge_requests_events expose :project_id, :issues_events, :confidential_issues_events
expose :note_events, :pipeline_events, :wiki_page_events expose :merge_requests_events, :note_events, :pipeline_events
expose :wiki_page_events
expose :job_events, as: :build_events expose :job_events, as: :build_events
end end
......
...@@ -11,6 +11,7 @@ module API ...@@ -11,6 +11,7 @@ module API
requires :url, type: String, desc: "The URL to send the request to" requires :url, type: String, desc: "The URL to send the request to"
optional :push_events, type: Boolean, desc: "Trigger hook on push events" optional :push_events, type: Boolean, desc: "Trigger hook on push events"
optional :issues_events, type: Boolean, desc: "Trigger hook on issues events" optional :issues_events, type: Boolean, desc: "Trigger hook on issues events"
optional :confidential_issues_events, type: Boolean, desc: "Trigger hook on confidential issues events"
optional :merge_requests_events, type: Boolean, desc: "Trigger hook on merge request events" optional :merge_requests_events, type: Boolean, desc: "Trigger hook on merge request events"
optional :tag_push_events, type: Boolean, desc: "Trigger hook on tag push events" optional :tag_push_events, type: Boolean, desc: "Trigger hook on tag push events"
optional :note_events, type: Boolean, desc: "Trigger hook on note(comment) events" optional :note_events, type: Boolean, desc: "Trigger hook on note(comment) events"
......
...@@ -29,6 +29,7 @@ describe Gitlab::ImportExport::RelationFactory do ...@@ -29,6 +29,7 @@ describe Gitlab::ImportExport::RelationFactory do
'service_id' => service_id, 'service_id' => service_id,
'push_events' => true, 'push_events' => true,
'issues_events' => false, 'issues_events' => false,
'confidential_issues_events' => false,
'merge_requests_events' => true, 'merge_requests_events' => true,
'tag_push_events' => false, 'tag_push_events' => false,
'note_events' => true, 'note_events' => true,
......
...@@ -28,6 +28,7 @@ describe API::ProjectHooks, 'ProjectHooks' do ...@@ -28,6 +28,7 @@ describe API::ProjectHooks, 'ProjectHooks' do
expect(json_response.count).to eq(1) expect(json_response.count).to eq(1)
expect(json_response.first['url']).to eq("http://example.com") expect(json_response.first['url']).to eq("http://example.com")
expect(json_response.first['issues_events']).to eq(true) expect(json_response.first['issues_events']).to eq(true)
expect(json_response.first['confidential_issues_events']).to eq(true)
expect(json_response.first['push_events']).to eq(true) expect(json_response.first['push_events']).to eq(true)
expect(json_response.first['merge_requests_events']).to eq(true) expect(json_response.first['merge_requests_events']).to eq(true)
expect(json_response.first['tag_push_events']).to eq(true) expect(json_response.first['tag_push_events']).to eq(true)
...@@ -56,6 +57,7 @@ describe API::ProjectHooks, 'ProjectHooks' do ...@@ -56,6 +57,7 @@ describe API::ProjectHooks, 'ProjectHooks' do
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
expect(json_response['url']).to eq(hook.url) expect(json_response['url']).to eq(hook.url)
expect(json_response['issues_events']).to eq(hook.issues_events) expect(json_response['issues_events']).to eq(hook.issues_events)
expect(json_response['confidential_issues_events']).to eq(hook.confidential_issues_events)
expect(json_response['push_events']).to eq(hook.push_events) expect(json_response['push_events']).to eq(hook.push_events)
expect(json_response['merge_requests_events']).to eq(hook.merge_requests_events) expect(json_response['merge_requests_events']).to eq(hook.merge_requests_events)
expect(json_response['tag_push_events']).to eq(hook.tag_push_events) expect(json_response['tag_push_events']).to eq(hook.tag_push_events)
...@@ -90,13 +92,14 @@ describe API::ProjectHooks, 'ProjectHooks' do ...@@ -90,13 +92,14 @@ describe API::ProjectHooks, 'ProjectHooks' do
it "adds hook to project" do it "adds hook to project" do
expect do expect do
post api("/projects/#{project.id}/hooks", user), post api("/projects/#{project.id}/hooks", user),
url: "http://example.com", issues_events: true, wiki_page_events: true, url: "http://example.com", issues_events: true, confidential_issues_events: true, wiki_page_events: true,
job_events: true job_events: true
end.to change {project.hooks.count}.by(1) end.to change {project.hooks.count}.by(1)
expect(response).to have_gitlab_http_status(201) expect(response).to have_gitlab_http_status(201)
expect(json_response['url']).to eq('http://example.com') expect(json_response['url']).to eq('http://example.com')
expect(json_response['issues_events']).to eq(true) expect(json_response['issues_events']).to eq(true)
expect(json_response['confidential_issues_events']).to eq(true)
expect(json_response['push_events']).to eq(true) expect(json_response['push_events']).to eq(true)
expect(json_response['merge_requests_events']).to eq(false) expect(json_response['merge_requests_events']).to eq(false)
expect(json_response['tag_push_events']).to eq(false) expect(json_response['tag_push_events']).to eq(false)
...@@ -144,6 +147,7 @@ describe API::ProjectHooks, 'ProjectHooks' do ...@@ -144,6 +147,7 @@ describe API::ProjectHooks, 'ProjectHooks' do
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
expect(json_response['url']).to eq('http://example.org') expect(json_response['url']).to eq('http://example.org')
expect(json_response['issues_events']).to eq(hook.issues_events) expect(json_response['issues_events']).to eq(hook.issues_events)
expect(json_response['confidential_issues_events']).to eq(hook.confidential_issues_events)
expect(json_response['push_events']).to eq(false) expect(json_response['push_events']).to eq(false)
expect(json_response['merge_requests_events']).to eq(hook.merge_requests_events) expect(json_response['merge_requests_events']).to eq(hook.merge_requests_events)
expect(json_response['tag_push_events']).to eq(hook.tag_push_events) expect(json_response['tag_push_events']).to eq(hook.tag_push_events)
......
...@@ -27,6 +27,7 @@ describe API::ProjectHooks, 'ProjectHooks' do ...@@ -27,6 +27,7 @@ describe API::ProjectHooks, 'ProjectHooks' do
expect(json_response.count).to eq(1) expect(json_response.count).to eq(1)
expect(json_response.first['url']).to eq("http://example.com") expect(json_response.first['url']).to eq("http://example.com")
expect(json_response.first['issues_events']).to eq(true) expect(json_response.first['issues_events']).to eq(true)
expect(json_response.first['confidential_issues_events']).to eq(true)
expect(json_response.first['push_events']).to eq(true) expect(json_response.first['push_events']).to eq(true)
expect(json_response.first['merge_requests_events']).to eq(true) expect(json_response.first['merge_requests_events']).to eq(true)
expect(json_response.first['tag_push_events']).to eq(true) expect(json_response.first['tag_push_events']).to eq(true)
...@@ -54,6 +55,7 @@ describe API::ProjectHooks, 'ProjectHooks' do ...@@ -54,6 +55,7 @@ describe API::ProjectHooks, 'ProjectHooks' do
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
expect(json_response['url']).to eq(hook.url) expect(json_response['url']).to eq(hook.url)
expect(json_response['issues_events']).to eq(hook.issues_events) expect(json_response['issues_events']).to eq(hook.issues_events)
expect(json_response['confidential_issues_events']).to eq(hook.confidential_issues_events)
expect(json_response['push_events']).to eq(hook.push_events) expect(json_response['push_events']).to eq(hook.push_events)
expect(json_response['merge_requests_events']).to eq(hook.merge_requests_events) expect(json_response['merge_requests_events']).to eq(hook.merge_requests_events)
expect(json_response['tag_push_events']).to eq(hook.tag_push_events) expect(json_response['tag_push_events']).to eq(hook.tag_push_events)
...@@ -87,12 +89,13 @@ describe API::ProjectHooks, 'ProjectHooks' do ...@@ -87,12 +89,13 @@ describe API::ProjectHooks, 'ProjectHooks' do
it "adds hook to project" do it "adds hook to project" do
expect do expect do
post v3_api("/projects/#{project.id}/hooks", user), post v3_api("/projects/#{project.id}/hooks", user),
url: "http://example.com", issues_events: true, wiki_page_events: true, build_events: true url: "http://example.com", issues_events: true, confidential_issues_events: true, wiki_page_events: true, build_events: true
end.to change {project.hooks.count}.by(1) end.to change {project.hooks.count}.by(1)
expect(response).to have_gitlab_http_status(201) expect(response).to have_gitlab_http_status(201)
expect(json_response['url']).to eq('http://example.com') expect(json_response['url']).to eq('http://example.com')
expect(json_response['issues_events']).to eq(true) expect(json_response['issues_events']).to eq(true)
expect(json_response['confidential_issues_events']).to eq(true)
expect(json_response['push_events']).to eq(true) expect(json_response['push_events']).to eq(true)
expect(json_response['merge_requests_events']).to eq(false) expect(json_response['merge_requests_events']).to eq(false)
expect(json_response['tag_push_events']).to eq(false) expect(json_response['tag_push_events']).to eq(false)
...@@ -139,6 +142,7 @@ describe API::ProjectHooks, 'ProjectHooks' do ...@@ -139,6 +142,7 @@ describe API::ProjectHooks, 'ProjectHooks' do
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
expect(json_response['url']).to eq('http://example.org') expect(json_response['url']).to eq('http://example.org')
expect(json_response['issues_events']).to eq(hook.issues_events) expect(json_response['issues_events']).to eq(hook.issues_events)
expect(json_response['confidential_issues_events']).to eq(hook.confidential_issues_events)
expect(json_response['push_events']).to eq(false) expect(json_response['push_events']).to eq(false)
expect(json_response['merge_requests_events']).to eq(hook.merge_requests_events) expect(json_response['merge_requests_events']).to eq(hook.merge_requests_events)
expect(json_response['tag_push_events']).to eq(hook.tag_push_events) expect(json_response['tag_push_events']).to eq(hook.tag_push_events)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment