Add controller and views for group & instance GitLab for Slack app
What does this MR do and why?
This is a step towards the feature of supporting the GitLab for Slack app integration to be configured at group and instance-level #391526 (closed).
The change adds route, controller and view support for group and instance level configuration of the integration. This allows the GitLab for Slack app integration to be edited at the group and instance levels. It represents the Controllers, routes and views slice in #391526 (comment 1733489044). Future iterations will allow the GitLab for Slack app to be enabled via OAuth with Slack.
The changes are hidden behind a feature flag.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Group level | Instance level |
---|---|
How to set up and validate locally
Set up
- In rails console enable the feature
Feature.enable(:gitlab_for_slack_app_instance_and_group_level)
- Enable the GitLab for Slack app for your instance:
- Go to
/admin
- Go Settings > General
- Next to GitLab for Slack app click Expand
- Check Enable GitLab for Slack app
- Enter the word
secret
into the form fields, and click Save
- Go to
QA Group level
- Create data (the next iteration will include functionality to create it through the UI #391526 (comment 1733489044)):
group = Group.find_by_full_path(...) integration = Integrations::GitlabSlackApplication.for_group(group).first || Integrations::GitlabSlackApplication.new(group: group) integration.assign_attributes(active: true) integration.save!(context: :manual_change) SlackIntegration.find_or_initialize_by(integration: integration).update(team_id: 'foo', team_name: "Foo Slack Workspace", alias: group.full_path, user_id: 'foo')
- Visit the group and go Settings > Integrations > GitLab for Slack app
- Verify that you can edit the form and click the red bin button to "unlink" the Slack app
- Toggle the flag off
Feature.disable(:gitlab_for_slack_app_instance_and_group_level)
- Wait around 1 minute for the flag cache to clear
- Verify that reloading the GitLab for Slack app form you get a 404
- Go Settings > Integrations and verify that you do not see the GitLab for Slack app listed
QA instance level
- Create data (the next iteration will include functionality to create it through the UI #391526 (comment 1733489044)):
integration = Integrations::GitlabSlackApplication.for_instance.first || Integrations::GitlabSlackApplication.new(instance: true) integration.assign_attributes(active: true) integration.save!(context: :manual_change) SlackIntegration.find_or_initialize_by(integration: integration).update(team_id: 'foo', team_name: "Foo Slack Workspace", alias: "instance", user_id: 'foo')
- Visit
/admin
and go Settings > Integrations > GitLab for Slack app - Verify that you can edit the form and click the red bin button to "unlink" the Slack app
- Toggle the flag off
Feature.disable(:gitlab_for_slack_app_instance_and_group_level)
- Wait around 1 minute for the flag cache to clear
- Verify that reloading the GitLab for Slack app form you get a 404
- Go Settings > Integrations and verify that you do not see the GitLab for Slack app listed
Related to #391526 (closed)