Disable the integrations sections if Slack app requires upgrade
What does this MR do and why?
The MR follows the UX plan introduced in Warn user conditionally if they need to update ... (#376240 - closed) for notifying users about the need to upgrade their version of the Slack application to be able to set up the Notifications (behind the feature flag).
The MR does 2 main things:
- Updates the type of the alert (
warning
todefault
) with some text updates according to the issue - Disables the fields on the GitLab for Slack app integration if user needs to upgrade Slack
Screenshots or screen recordings
Jira screenshots are used as a blueprint to make sure the changes to not leak into other integrations.
Before | After | |
---|---|---|
Jira | ![]() |
![]() |
GitLab for Slack | ![]() |
![]() |
How to set up and validate locally
- Check that the Slack Application (for example,
http://127.0.0.1:3000/flightjs/Flight/-/settings/integrations/gitlab_slack_application/edit
) and Jira (for examplehttp://127.0.0.1:3000/flightjs/Flight/-/settings/integrations/jira/edit
) integrations look fine - Apply the patch to get the dummy sections pushed for the Slack Application integrations:
Patch
diff --git a/ee/app/models/integrations/gitlab_slack_application.rb b/ee/app/models/integrations/gitlab_slack_application.rb
index faf86cfa2511..46f5501f2a13 100644
--- a/ee/app/models/integrations/gitlab_slack_application.rb
+++ b/ee/app/models/integrations/gitlab_slack_application.rb
@@ -58,9 +58,48 @@ def editable?
override :fields
def fields
- return [] unless editable?
+ # return [] unless editable?
+ [
+ {
+ type: 'checkbox',
+ name: 'notify_only_broken_pipelines',
+ section: SECTION_TYPE_CONNECTION,
+ help: 'Do not send notifications for successful pipelines.'
+ },
+ {
+ 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
+ },
+ {
+ 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.'
+ },
+ {
+ 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
+ end
- super
+ def sections
+ [
+ {
+ type: SECTION_TYPE_CONNECTION,
+ title: s_('Integrations|Notifications'),
+ description: help
+ }
+ ]
end
override :configurable_events
- Re-check the aforementioned integrations - those should look exactly as they used to
- Enable the feature flag in the rails console (
rails c
):Feature.enable(:integration_slack_app_notifications)
- Check the integrations again. The "GitLab for Slack Application" should list the sections and the banner, as shown in the screenshot above. Jira integration should not be affected.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #376240 (closed)