Commit 994a2367 authored by Mathieu Parent's avatar Mathieu Parent

Add emails_disabled to projects API

parent 065f3e03
---
title: Add emails_disabled to projects API
merge_request: 23616
author: Mathieu Parent
type: added
...@@ -1016,6 +1016,7 @@ POST /projects ...@@ -1016,6 +1016,7 @@ POST /projects
| `wiki_access_level` | string | no | One of `disabled`, `private` or `enabled` | | `wiki_access_level` | string | no | One of `disabled`, `private` or `enabled` |
| `snippets_access_level` | string | no | One of `disabled`, `private` or `enabled` | | `snippets_access_level` | string | no | One of `disabled`, `private` or `enabled` |
| `pages_access_level` | string | no | One of `disabled`, `private`, `enabled` or `public` | | `pages_access_level` | string | no | One of `disabled`, `private`, `enabled` or `public` |
| `emails_disabled` | boolean | no | Disable email notifications |
| `resolve_outdated_diff_discussions` | boolean | no | Automatically resolve merge request diffs discussions on lines changed with a push | | `resolve_outdated_diff_discussions` | boolean | no | Automatically resolve merge request diffs discussions on lines changed with a push |
| `container_registry_enabled` | boolean | no | Enable container registry for this project | | `container_registry_enabled` | boolean | no | Enable container registry for this project |
| `container_expiration_policy_attributes` | hash | no | Update the container expiration policy for this project. Accepts: `cadence` (string), `keep_n` (string), `older_than` (string), `name_regex` (string), `enabled` (boolean) | | `container_expiration_policy_attributes` | hash | no | Update the container expiration policy for this project. Accepts: `cadence` (string), `keep_n` (string), `older_than` (string), `name_regex` (string), `enabled` (boolean) |
...@@ -1083,6 +1084,7 @@ POST /projects/user/:user_id ...@@ -1083,6 +1084,7 @@ POST /projects/user/:user_id
| `wiki_access_level` | string | no | One of `disabled`, `private` or `enabled` | | `wiki_access_level` | string | no | One of `disabled`, `private` or `enabled` |
| `snippets_access_level` | string | no | One of `disabled`, `private` or `enabled` | | `snippets_access_level` | string | no | One of `disabled`, `private` or `enabled` |
| `pages_access_level` | string | no | One of `disabled`, `private`, `enabled` or `public` | | `pages_access_level` | string | no | One of `disabled`, `private`, `enabled` or `public` |
| `emails_disabled` | boolean | no | Disable email notifications |
| `resolve_outdated_diff_discussions` | boolean | no | Automatically resolve merge request diffs discussions on lines changed with a push | | `resolve_outdated_diff_discussions` | boolean | no | Automatically resolve merge request diffs discussions on lines changed with a push |
| `container_registry_enabled` | boolean | no | Enable container registry for this project | | `container_registry_enabled` | boolean | no | Enable container registry for this project |
| `shared_runners_enabled` | boolean | no | Enable shared runners for this project | | `shared_runners_enabled` | boolean | no | Enable shared runners for this project |
...@@ -1149,6 +1151,7 @@ PUT /projects/:id ...@@ -1149,6 +1151,7 @@ PUT /projects/:id
| `wiki_access_level` | string | no | One of `disabled`, `private` or `enabled` | | `wiki_access_level` | string | no | One of `disabled`, `private` or `enabled` |
| `snippets_access_level` | string | no | One of `disabled`, `private` or `enabled` | | `snippets_access_level` | string | no | One of `disabled`, `private` or `enabled` |
| `pages_access_level` | string | no | One of `disabled`, `private`, `enabled` or `public` | | `pages_access_level` | string | no | One of `disabled`, `private`, `enabled` or `public` |
| `emails_disabled` | boolean | no | Disable email notifications |
| `resolve_outdated_diff_discussions` | boolean | no | Automatically resolve merge request diffs discussions on lines changed with a push | | `resolve_outdated_diff_discussions` | boolean | no | Automatically resolve merge request diffs discussions on lines changed with a push |
| `container_registry_enabled` | boolean | no | Enable container registry for this project | | `container_registry_enabled` | boolean | no | Enable container registry for this project |
| `container_expiration_policy_attributes` | hash | no | Update the container expiration policy for this project. Accepts: `cadence` (string), `keep_n` (string), `older_than` (string), `name_regex` (string), `enabled` (boolean) | | `container_expiration_policy_attributes` | hash | no | Update the container expiration policy for this project. Accepts: `cadence` (string), `keep_n` (string), `older_than` (string), `name_regex` (string), `enabled` (boolean) |
......
...@@ -64,6 +64,7 @@ module API ...@@ -64,6 +64,7 @@ module API
expose(:snippets_access_level) { |project, options| project.project_feature.string_access_level(:snippets) } expose(:snippets_access_level) { |project, options| project.project_feature.string_access_level(:snippets) }
expose(:pages_access_level) { |project, options| project.project_feature.string_access_level(:pages) } expose(:pages_access_level) { |project, options| project.project_feature.string_access_level(:pages) }
expose :emails_disabled
expose :shared_runners_enabled expose :shared_runners_enabled
expose :lfs_enabled?, as: :lfs_enabled expose :lfs_enabled?, as: :lfs_enabled
expose :creator_id expose :creator_id
......
...@@ -29,6 +29,7 @@ module API ...@@ -29,6 +29,7 @@ module API
optional :snippets_access_level, type: String, values: %w(disabled private enabled), desc: 'Snippets access level. One of `disabled`, `private` or `enabled`' optional :snippets_access_level, type: String, values: %w(disabled private enabled), desc: 'Snippets access level. One of `disabled`, `private` or `enabled`'
optional :pages_access_level, type: String, values: %w(disabled private enabled public), desc: 'Pages access level. One of `disabled`, `private`, `enabled` or `public`' optional :pages_access_level, type: String, values: %w(disabled private enabled public), desc: 'Pages access level. One of `disabled`, `private`, `enabled` or `public`'
optional :emails_disabled, type: Boolean, desc: 'Disable email notifications'
optional :shared_runners_enabled, type: Boolean, desc: 'Flag indication if shared runners are enabled for that project' optional :shared_runners_enabled, type: Boolean, desc: 'Flag indication if shared runners are enabled for that project'
optional :resolve_outdated_diff_discussions, type: Boolean, desc: 'Automatically resolve merge request diffs discussions on lines changed with a push' optional :resolve_outdated_diff_discussions, type: Boolean, desc: 'Automatically resolve merge request diffs discussions on lines changed with a push'
optional :remove_source_branch_after_merge, type: Boolean, desc: 'Remove the source branch by default after merge' optional :remove_source_branch_after_merge, type: Boolean, desc: 'Remove the source branch by default after merge'
...@@ -87,6 +88,7 @@ module API ...@@ -87,6 +88,7 @@ module API
def self.update_params_at_least_one_of def self.update_params_at_least_one_of
[ [
:autoclose_referenced_issues,
:auto_devops_enabled, :auto_devops_enabled,
:auto_devops_deploy_strategy, :auto_devops_deploy_strategy,
:auto_cancel_pending_pipelines, :auto_cancel_pending_pipelines,
...@@ -100,7 +102,7 @@ module API ...@@ -100,7 +102,7 @@ module API
:container_expiration_policy_attributes, :container_expiration_policy_attributes,
:default_branch, :default_branch,
:description, :description,
:autoclose_referenced_issues, :emails_disabled,
:issues_access_level, :issues_access_level,
:lfs_enabled, :lfs_enabled,
:merge_requests_access_level, :merge_requests_access_level,
......
...@@ -1402,6 +1402,7 @@ describe API::Projects do ...@@ -1402,6 +1402,7 @@ describe API::Projects do
expect(json_response['merge_requests_access_level']).to be_present expect(json_response['merge_requests_access_level']).to be_present
expect(json_response['wiki_access_level']).to be_present expect(json_response['wiki_access_level']).to be_present
expect(json_response['builds_access_level']).to be_present expect(json_response['builds_access_level']).to be_present
expect(json_response).to have_key('emails_disabled')
expect(json_response['resolve_outdated_diff_discussions']).to eq(project.resolve_outdated_diff_discussions) expect(json_response['resolve_outdated_diff_discussions']).to eq(project.resolve_outdated_diff_discussions)
expect(json_response['remove_source_branch_after_merge']).to be_truthy expect(json_response['remove_source_branch_after_merge']).to be_truthy
expect(json_response['container_registry_enabled']).to be_present expect(json_response['container_registry_enabled']).to be_present
...@@ -1412,18 +1413,18 @@ describe API::Projects do ...@@ -1412,18 +1413,18 @@ describe API::Projects do
expect(json_response['namespace']).to be_present expect(json_response['namespace']).to be_present
expect(json_response['import_status']).to be_present expect(json_response['import_status']).to be_present
expect(json_response).to include("import_error") expect(json_response).to include("import_error")
expect(json_response['avatar_url']).to be_nil expect(json_response).to have_key('avatar_url')
expect(json_response['star_count']).to be_present expect(json_response['star_count']).to be_present
expect(json_response['forks_count']).to be_present expect(json_response['forks_count']).to be_present
expect(json_response['public_jobs']).to be_present expect(json_response['public_jobs']).to be_present
expect(json_response['ci_config_path']).to be_nil expect(json_response).to have_key('ci_config_path')
expect(json_response['shared_with_groups']).to be_an Array expect(json_response['shared_with_groups']).to be_an Array
expect(json_response['shared_with_groups'].length).to eq(1) expect(json_response['shared_with_groups'].length).to eq(1)
expect(json_response['shared_with_groups'][0]['group_id']).to eq(group.id) expect(json_response['shared_with_groups'][0]['group_id']).to eq(group.id)
expect(json_response['shared_with_groups'][0]['group_name']).to eq(group.name) expect(json_response['shared_with_groups'][0]['group_name']).to eq(group.name)
expect(json_response['shared_with_groups'][0]['group_full_path']).to eq(group.full_path) expect(json_response['shared_with_groups'][0]['group_full_path']).to eq(group.full_path)
expect(json_response['shared_with_groups'][0]['group_access_level']).to eq(link.group_access) expect(json_response['shared_with_groups'][0]['group_access_level']).to eq(link.group_access)
expect(json_response['shared_with_groups'][0]['expires_at']).to be_nil expect(json_response['shared_with_groups'][0]).to have_key('expires_at')
expect(json_response['only_allow_merge_if_pipeline_succeeds']).to eq(project.only_allow_merge_if_pipeline_succeeds) expect(json_response['only_allow_merge_if_pipeline_succeeds']).to eq(project.only_allow_merge_if_pipeline_succeeds)
expect(json_response['only_allow_merge_if_all_discussions_are_resolved']).to eq(project.only_allow_merge_if_all_discussions_are_resolved) expect(json_response['only_allow_merge_if_all_discussions_are_resolved']).to eq(project.only_allow_merge_if_all_discussions_are_resolved)
expect(json_response['ci_default_git_depth']).to eq(project.ci_default_git_depth) expect(json_response['ci_default_git_depth']).to eq(project.ci_default_git_depth)
...@@ -2243,6 +2244,16 @@ describe API::Projects do ...@@ -2243,6 +2244,16 @@ describe API::Projects do
expect(json_response['pages_access_level']).to eq('private') expect(json_response['pages_access_level']).to eq('private')
end end
it 'updates emails_disabled' do
project_param = { emails_disabled: true }
put api("/projects/#{project3.id}", user), params: project_param
expect(response).to have_gitlab_http_status(200)
expect(json_response['emails_disabled']).to eq(true)
end
it 'updates build_git_strategy' do it 'updates build_git_strategy' do
project_param = { build_git_strategy: 'clone' } project_param = { build_git_strategy: 'clone' }
......
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