Commit ae434ccc authored by Rémy Coutable's avatar Rémy Coutable

Merge branch '39895-cant-set-mattermost-username-channel-from-api' into 'master'

Fix acceptance of username for Mattermost service update

Closes #39895

See merge request gitlab-org/gitlab-ce!15275
parents 43d98cd1 12d622eb
---
title: Fix acceptance of username for Mattermost service update
merge_request: 15275
author:
type: fixed
...@@ -572,7 +572,7 @@ Parameters: ...@@ -572,7 +572,7 @@ Parameters:
| Attribute | Type | Required | Description | | Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- | | --------- | ---- | -------- | ----------- |
| `token` | string | yes | The Mattermost token | | `token` | string | yes | The Mattermost token |
| `username` | string | no | The username to use to post the message |
### Delete Mattermost slash command service ### Delete Mattermost slash command service
......
...@@ -522,6 +522,12 @@ module API ...@@ -522,6 +522,12 @@ module API
name: :webhook, name: :webhook,
type: String, type: String,
desc: 'The Mattermost webhook. e.g. http://mattermost_host/hooks/...' desc: 'The Mattermost webhook. e.g. http://mattermost_host/hooks/...'
},
{
required: false,
name: :username,
type: String,
desc: 'The username to use to post the message'
} }
], ],
'teamcity' => [ 'teamcity' => [
......
...@@ -175,4 +175,25 @@ describe API::Services do ...@@ -175,4 +175,25 @@ describe API::Services do
end end
end end
end end
describe 'Mattermost service' do
let(:service_name) { 'mattermost' }
let(:params) do
{ webhook: 'https://hook.example.com', username: 'username' }
end
before do
project.create_mattermost_service(
active: true,
properties: params
)
end
it 'accepts a username for update' do
put api("/projects/#{project.id}/services/mattermost", user), params.merge(username: 'new_username')
expect(response).to have_gitlab_http_status(200)
expect(json_response['properties']['username']).to eq('new_username')
end
end
end end
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