Backend: require `resource_id` for Chat Slash commands
Related: gitlab-vscode-extension#1360 (closed)
That issue adds a resource_id
to the Slash command GraphQL request. When the resource_id
is for a project with Duo Features enabled set to false, the GraphQL response is an error (which is what we want).
More info on the graphql request: gitlab-vscode-extension#1360 (comment 1913210077)
On the backend, we should require that resource_id
is sent with the request when it is a Slash command. How do we know it is a Slash command? This regex is how.
We already return an error if the resource_id
passed for an Issue or Epic question is invalid here.
We should add similar logic to the Slash command Chat tools so that an error is raised if the resource_id
is nil
or invalid.
And, this functionality should be behind a default off feature flag that is scoped to groups. So, if the user making the request is the member of a group with the feature flag enabled, the resource_id
is required. Otherwise, it is not required. This will ensure that we can roll this change out to select groups and also not break slash commands for users on older versions of our editor extension.