Make Mattermost Command easier to configure

Description

The project service Mattermost Command is pretty complex to configure and all of it could be automated using their APIs and our existing integration; at least if Mattermost is installed as part of Omnibus.

Proposal

  • If Mattermost is installed by Omnibus or if SSO GitLab<>Mattermost is configured, detect the configuration automatically.
  • Replace instructions and form with Add to Mattermost button (but still provide instructions and form if Mattermost is not detected).
  • When pressing the Add to Mattermost button, the user is authenticated against Mattermost and enters an installation flow (see design below).
  • After the installation is complete, the user can see in which Mattermost team the command was installed and also a Edit in Mattermost button to configure or remove the installation

Flow and screens design

🔍 Check design specs (for spacing, sizes, colors and text copying) — Hide the notes using the control in the top-right corner

Overall flow

1) Service (not installed) 2) OAuth in Mattermost 3) Service installation flow in GitLab 4) Service (successfully installed)
image image See Service installation scenarios below image

The OAuth screen comes from Mattermost's docs

The “Edit in Mattermost” button links to: http://<mattermost-url>/<team-name>/integrations/commands/edit?id=<slash-command-id>

Service installation scenarios

Multiple teams One team No permission No teams
image image image image

Below the team selection input, the help text varies according to the following scenarios:

  • If the user is not system admin AND the Restrict managing integrations to Admins option is true: “You can only install in teams where you are an administrator.”
  • If the user is not system admin AND the Enable Team Creation option is false: “To create a team, ask your Mattermost system administrator.”
  • If the user is system admin OR the Enable Team Creation option is true: “To create a team, use Mattermost’s interface”

The No permission screen appears if the Restrict managing integrations to Admins option is true AND the user is not an administrator of any team or system admin.

The No teams screen appears:

  • if the Restrict managing integrations to Admins option is false AND the user isn't a member of any team
  • OR if the Enable Team Creation option is true and there are no teams created yet
  • OR if the Enable Team Creation option is false and the user is system admin

The “see list of built-in slash commands” links to https://docs.mattermost.com/help/messaging/executing-commands.html#built-in-commands, the “use Mattermost’s interface” links to http://<mattermost-url>/create_team and the “join a team” links to http://<mattermost-url>/select_team

Links / references