Add an endpoint to move a command to another team

Description

This ticket includes the implementation of an API endpoint in the Mattermost API to move a slash command by to another team. Includes the corresponding API documentation.

QA Test Steps

This API can be exercised using curl by first creating a json file containing the destination team-id. For example tid.json:
{
"team_id": "<the id>"
}

The curl command would then be (replace the command_id and session_id):

curl -X PUT 'http://your-mattermost-url.com/api/v4/commands/{command_id}/move' -H 'Authorization: Bearer YOUR_USER_SESSION_ID' -H 'Content-Type: application/json' -d @tid.json

This should result in a HTTP 200 status and json payload containing "{'status':'OK'}". The following curl command can be used to verify the command exists on the destination team (replace team_id):

curl -X GET 'http://your-mattermost-url.com/api/v4/commands?team_id={teamd_id}&custom_only=true' -H 'Authorization: Bearer YOUR_USER_SESSION_ID'

The same curl commands can be used for the following tests:

  • without a session (401 expected)

  • missing json payload (400 expected)

  • non-admin and/or user without manage_slash_commands permission for destination team (403 expected)

  • invalid command_id (404 expected)

  • non-admin and/or user without manage_slash_commands permission for team the command is currently assigned to (404 expected)

Mana

None

Assignee

Doug Lauder

QA Assignee

Saturnino Abril

Reporter

Doug Lauder

Epic Link

Fix versions

Mattermost Team

Platform

Sprint

None

Labels

None

QA Testing Areas

API

GitHub Issue

None

Components

None
Configure