Commit 3c39bbe6 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch '34261-toggle-service-desk' into 'master'

Support toggling service desk from API

See merge request gitlab-org/gitlab!21627
parents 707d50f3 ec7f91d7
---
title: Support toggling service desk from API
merge_request: 21627
author:
type: changed
......@@ -1135,6 +1135,7 @@ PUT /projects/:id
| `only_mirror_protected_branches` | boolean | no | **(STARTER)** Only mirror protected branches |
| `mirror_overwrites_diverged_branches` | boolean | no | **(STARTER)** Pull mirror overwrites diverged branches |
| `packages_enabled` | boolean | no | **(PREMIUM ONLY)** Enable or disable packages repository feature |
| `service_desk_enabled` | boolean | no | **(PREMIUM ONLY)** Enable or disable service desk feature |
NOTE: **Note:** If your HTTP repository is not publicly accessible,
add authentication information to the URL: `https://username:password@gitlab.company.com/group/project.git`
......
......@@ -21,6 +21,7 @@ module EE
optional :mirror, type: Grape::API::Boolean, desc: 'Enables pull mirroring in a project'
optional :mirror_trigger_builds, type: Grape::API::Boolean, desc: 'Pull mirroring triggers builds'
optional :external_authorization_classification_label, type: String, desc: 'The classification label for the project'
optional :service_desk_enabled, type: Grape::API::Boolean, desc: 'Disable or enable the service desk'
end
params :optional_filter_params_ee do
......@@ -53,7 +54,8 @@ module EE
:external_authorization_classification_label,
:import_url,
:packages_enabled,
:fallback_approvals_required
:fallback_approvals_required,
:service_desk_enabled
]
end
end
......
......@@ -449,6 +449,27 @@ describe API::Projects do
end
end
context 'when updating service desk' do
subject { put(api("/projects/#{project.id}", user), params: { service_desk_enabled: true }) }
before do
stub_licensed_features(service_desk: true)
project.update!(service_desk_enabled: false)
allow(::Gitlab::IncomingEmail).to receive(:enabled?).and_return(true)
end
it 'returns 200' do
subject
expect(response).to have_gitlab_http_status(200)
end
it 'enables the service_desk' do
expect { subject }.to change { project.reload.service_desk_enabled }.to(true)
end
end
context 'when updating repository storage' do
let(:unknown_storage) { 'new-storage' }
let(:new_project) { create(:project, :repository, namespace: user.namespace) }
......
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