From 5a5db0508a4dad5f0ddda6f3565152e00faebc47 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Wed, 19 Jun 2019 05:43:35 +0000 Subject: [PATCH] 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 (cherry picked from commit 51267258d1c39835c995eaaf29b7df678334ded1) d5d2f8fb 59702 Fix API notification flags for MS Teams f7658c0f 59702 Add changelog entry 1ce2c4dc Add missing test for Microsoft Teams notify_only_default_branch flag --- .../59702-fix-notification-flags-for-ms-teams.yml | 5 +++++ doc/api/services.md | 2 ++ lib/api/helpers/services_helpers.rb | 5 +++-- .../project_services/microsoft_teams_service_spec.rb | 12 ++++++++++++ 4 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 changelogs/unreleased/59702-fix-notification-flags-for-ms-teams.yml 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 -- GitLab