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 0000000000000000000000000000000000000000..14a8da95ed983f80d13df2f44a19ef25029d5fe4 --- /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 f38f96f64ad1c73e0614b8b330b443703679fd9d..042fee4a21a61bcc615a34cf4a516f3d731621cb 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 44c577204b8083bc1118f726a364d954029403f0..cf2e9d01356efb52e246ded5e46f7407eb4263fa 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 c025d7c882ef7740032c8fddb7f6cfd7853abc5d..3ffe633868f42a917e4bb073271ed59df0dcbac4 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