summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2019-06-19 05:43:35 +0000
committerStan Hu <stanhu@gmail.com>2019-06-19 05:43:35 +0000
commit51267258d1c39835c995eaaf29b7df678334ded1 (patch)
tree0d04c9d1a9c2c7e79d3cb8f5a953064c2a3e7e39
parent0cd04bf35fd93a787afbf90da3284e8ecdfe424f (diff)
parent1ce2c4dcafce0aa7338647001b3c2b13b721640a (diff)
downloadgitlab-ce-51267258d1c39835c995eaaf29b7df678334ded1.tar.gz
Merge branch 'fix-microsoft-teams-notification-flags' into 'master'
Fix missing API notification flags for Microsoft Teams See merge request gitlab-org/gitlab-ce!29824
-rw-r--r--changelogs/unreleased/59702-fix-notification-flags-for-ms-teams.yml5
-rw-r--r--doc/api/services.md2
-rw-r--r--lib/api/helpers/services_helpers.rb5
-rw-r--r--spec/models/project_services/microsoft_teams_service_spec.rb12
4 files changed, 22 insertions, 2 deletions
diff --git a/changelogs/unreleased/59702-fix-notification-flags-for-ms-teams.yml b/changelogs/unreleased/59702-fix-notification-flags-for-ms-teams.yml
new file mode 100644
index 00000000000..14a8da95ed9
--- /dev/null
+++ b/changelogs/unreleased/59702-fix-notification-flags-for-ms-teams.yml
@@ -0,0 +1,5 @@
+---
+title: Fix missing API notification flags for Microsoft Teams
+merge_request: 29824
+author: Seiji Suenaga
+type: fixed
diff --git a/doc/api/services.md b/doc/api/services.md
index f38f96f64ad..042fee4a21a 100644
--- a/doc/api/services.md
+++ b/doc/api/services.md
@@ -1023,6 +1023,8 @@ Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `webhook` | string | true | The Microsoft Teams webhook. For example, `https://outlook.office.com/webhook/...` |
+| `notify_only_broken_pipelines` | boolean | false | Send notifications for broken pipelines |
+| `notify_only_default_branch` | boolean | false | Send notifications only for the default branch |
| `push_events` | boolean | false | Enable notifications for push events |
| `issues_events` | boolean | false | Enable notifications for issue events |
| `confidential_issues_events` | boolean | false | Enable notifications for confidential issue events |
diff --git a/lib/api/helpers/services_helpers.rb b/lib/api/helpers/services_helpers.rb
index 44c577204b8..cf2e9d01356 100644
--- a/lib/api/helpers/services_helpers.rb
+++ b/lib/api/helpers/services_helpers.rb
@@ -683,8 +683,9 @@ module API
name: :webhook,
type: String,
desc: 'The Microsoft Teams webhook. e.g. https://outlook.office.com/webhook/…'
- }
- ],
+ },
+ chat_notification_flags
+ ].flatten,
'mattermost' => [
chat_notification_settings,
chat_notification_flags,
diff --git a/spec/models/project_services/microsoft_teams_service_spec.rb b/spec/models/project_services/microsoft_teams_service_spec.rb
index c025d7c882e..3ffe633868f 100644
--- a/spec/models/project_services/microsoft_teams_service_spec.rb
+++ b/spec/models/project_services/microsoft_teams_service_spec.rb
@@ -289,6 +289,18 @@ describe MicrosoftTeamsService do
expect(result).to be_falsy
end
end
+
+ context 'when disabled' do
+ let(:pipeline) do
+ create(:ci_pipeline, :failed, project: project, ref: 'not-the-default-branch')
+ end
+
+ before do
+ chat_service.notify_only_default_branch = false
+ end
+
+ it_behaves_like 'call Microsoft Teams API'
+ end
end
end
end