Skip to content

Remove `service` instance var

Luke Duncalfe requested to merge 391526-remove-service-instance-var into master

What does this MR do and why?

This is forward refactoring for #391526 (closed) where the GitLab for Slack app integration will be configured for a group and an instance.

We won't add a has_one :gitlab_slack_application_integration association to Group as this is discouraged and we can avoid needing to do so if we instead look up the integration through the SlackIntegration record.

There should be no functional changes.

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.

How to set up and validate locally

Verify that these steps are possible without errors:

  1. Manually create a GitLab for Slack app integration locally. On your rails console:
    project = Project.find_by_full_path(<project-full-path>)
    
    # Create a GitLab Slack Application integration
    integration = project.find_or_initialize_integration('gitlab_slack_application')
    integration.assign_attributes(active: true)
    integration.save!(context: :manual_change)
    
    # Create a mock SlackIntegration record, which normally happens when someone goes through the Slack
    # app installation flow, authorizing with their Slack workspace:
    SlackIntegration.create(integration: integration, team_id: 'foo', team_name: 'foo', alias: 'foo', user_id: 'foo')
  2. Visit http://gdk.test:3000/<PROJECT_FULL_PATH>/-/settings/integrations/gitlab_slack_application/edit
  3. In the table near the top of the form (with heading Team name) click Edit.
  4. Enter a new alias and save.

Related to #391526 (closed)

Edited by Luke Duncalfe

Merge request reports