Skip to content

Slash commands should identify project by full path, even with there is an alias

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Currently, all slash commands that take a project (example: /gitlab <project> issue show 1) identify the project by an alias, rather than the project full path.

The alias can be set from the GitLab for Slack integration form.

Problem

Users must know the alias in order to use the slash command otherwise they experience the slash command as broken.

By default, the alias will be the same as the project's full path.

But when the alias has changed, the full path does not work in slash commands, which can be counterintuitive for users.

For example, this will error with a "project not found" response:

/gitlab gitlab-org/gitlab issue show 386430

Instead, we must use the configured alias:

/gitlab gitlab-ee issue show 386430

Solution

In addition to supporting project aliases in slash commands, also support regular project full paths where they are different.

For example, GitLab workspace users should be able to use either of these slash commands interchangeably:

/gitlab gitlab-org/gitlab issue show 386430
/gitlab gitlab-ee issue show 386430

Availability & Testing

This behavior would seem to result in a change to SlashCommands::GlobalSlackHandler#find_slack_integration

Let's add/modify tests to https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/spec/services/slash_commands/global_slack_handler_spec.rb around the following scenarios

context "with existing project" do
  context "with alias" do
    it "handles command using alias" {}
    it "handles command using project path" {}
  end

  it "handles command using project path" {}
  it "raises error using missing/incorrect alias" {}
end
Edited by 🤖 GitLab Bot 🤖