Protect integration sections for Slack App with a feature flag
1 unresolved thread
1 unresolved thread
Compare changes
Files
2- Denys Mishunov authored
@@ -233,7 +233,11 @@ export default {
The MR introduces the support for the :integration_slack_app_notifications
feature flag in the frontend and uses it to protect sections in Slack Application integration form while there's an ongoing process of merging the Slack Notifications integration into the Slack Application.
For the reference, here's the flowchart for the conditions taken from #372410 (comment 1127170652):
flowchart TB;
id1["show help HTML + sections"]
id2["show ONLY sections"]
id3["show ONLY help HTML"]
A{"Are we on 'gitlab_slack_application'?"} --> |Yes|B{is FF turned ON?}
B -->|Yes|id1;
B -->|No|id3;
D{Do we have sections?};
A --> |No|D;
D --> |"No"|id3;
D --> |"Yes"|id2
Route | Before | After with the flag OFF | After with the flag ON |
---|---|---|---|
Slack Application without sections | ![]() |
![]() |
![]() |
Slack Application with mocked sections (see patch below) | ![]() |
![]() |
![]() |
Jira | ![]() |
![]() |
![]() |
/-/settings/integrations/gitlab_slack_application/edit
) and Jira (-/settings/integrations/jira/edit) integrations look finediff --git a/ee/app/models/integrations/gitlab_slack_application.rb b/ee/app/models/integrations/gitlab_slack_application.rb
index 08c869eca5c..d570109986e 100644
--- a/ee/app/models/integrations/gitlab_slack_application.rb
+++ b/ee/app/models/integrations/gitlab_slack_application.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module Integrations
- class GitlabSlackApplication < Integration
+ class GitlabSlackApplication < BaseChatNotification
default_value_for :category, 'chat'
has_one :slack_integration, foreign_key: :integration_id
@@ -39,7 +39,51 @@ def self.to_param
end
def fields
- []
+ [
+ {
+ type: 'checkbox',
+ name: 'notify_only_broken_pipelines',
+ section: SECTION_TYPE_CONNECTION,
+ help: 'Do not send notifications for successful pipelines.'
+ }.freeze,
+ {
+ type: 'select',
+ name: 'branches_to_be_notified',
+ section: SECTION_TYPE_CONNECTION,
+ title: s_('Integrations|Branches for which notifications are to be sent'),
+ choices: Integrations::Slack.branch_choices
+ }.freeze,
+ {
+ type: 'text',
+ name: 'labels_to_be_notified',
+ section: SECTION_TYPE_CONNECTION,
+ placeholder: '~backend,~frontend',
+ help: 'Send notifications for issue, merge request, and comment events with the listed labels only. Leave blank to receive notifications for all events.'
+ }.freeze,
+ {
+ type: 'select',
+ section: SECTION_TYPE_CONNECTION,
+ name: 'labels_to_be_notified_behavior',
+ choices: [
+ ['Match any of the labels', MATCH_ANY_LABEL],
+ ['Match all of the labels', MATCH_ALL_LABELS]
+ ]
+ }.freeze
+ ].freeze
+ end
+
+ def sections
+ [
+ {
+ type: SECTION_TYPE_TRIGGER,
+ title: s_('Integrations|Notifications trigger')
+ },
+ {
+ type: SECTION_TYPE_CONNECTION,
+ title: s_('Integrations|Notifications'),
+ description: help
+ }
+ ]
end
def chat_responder
rails c
): Feature.enable(:integration_slack_app_notifications)
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #375046 (closed) and #372410 (closed)