Skip to content

Move Slack trigger API endpoint to Core

Luke Duncalfe requested to merge 355896-slack-trigger-api-and-handler into master

What does this MR do and why?

This change is part of #355896 (closed) to move all GitLab for Slack app code to Core.

This MR focuses on moving:

  • slack/trigger API endpoint
  • Related handler classes

A changelog entry, and any documentation changes, will be added in the final MR.

There should be no functional changes.

QA Steps

Full local testing using a Slack app is only possible for groupimport and integrate team members because you need access to some Slack developer tooling (I'm unsure if you can see this document, but it outlines what's required).

We can perform simple tests again the API endpoint though:

  1. Apply this patch:
    diff --git a/ee/app/views/admin/application_settings/_slack.html.haml b/ee/app/views/admin/application_settings/_slack.html.haml
    index 5667a94224ad..6b22595cf88c 100644
    --- a/ee/app/views/admin/application_settings/_slack.html.haml
    +++ b/ee/app/views/admin/application_settings/_slack.html.haml
    @@ -1,4 +1,4 @@
    -- return unless Gitlab.com?
    +-# - return unless Gitlab.com?
    
    - expanded = integration_expanded?('slack_app_')
    %section.settings.as-slack.no-animate#js-slack-settings{ class: ('expanded' if expanded) }
  2. Visit /admin/application_settings/general and expand Slack application.
  3. Add a Verification token
  4. Perform a curl request locally:
    curl --request POST --header "Content-Type: application/json" \
         --data '{"token":"<TOKEN>", "text":"help"}'  http://gdk.test:3000/api/v4/slack/trigger 
  5. You should see a response that starts with {"response_type":"ephemeral","status":200,"text":"*Available commands [...]

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #355896 (closed)

Edited by Luke Duncalfe

Merge request reports