Comment with slash-command only causes error
Summary
Creating a comment on an MR (and issue probably too?) shows an error when the content of the comment is just slash command(s). The slash-command is executed though.
Steps to reproduce
- Open an MR in the webview
- Type
/assign @kevslashnull(or @ your name) in the text area - Click on “Comment”
- See the error “Failed to save your comment. Please try again.” after a while
What is the current bug behavior?
A comment with just slash-commands causes an error but is executed.
What is the expected correct behavior?
A comment with just slash-commands executes the commands and shows the system note in the comments.
Relevant logs and/or screenshots
{
"userMessage": "Couldn't create the comment when calling the API.\n For more information, review the extension logs.",
"errorMessage": "Commands only Removed assignee @KevSlashNull.",
"stack": [
"Error: Commands only Removed assignee @KevSlashNull.",
"\tat GitLabNewService.<anonymous> (/Users/kev/Development/Kev/gitlab-vscode-extension/out/src/gitlab/gitlab_new_service.js:387:60)",
"\tat Generator.next (<anonymous>)",
"\tat fulfilled (/Users/kev/Development/Kev/gitlab-vscode-extension/out/src/gitlab/gitlab_new_service.js:5:58)",
"\tat runMicrotasks (<anonymous>)",
"\tat processTicksAndRejections (internal/process/task_queues.js:97:5)"
]
}
Possible fixes
Affected line: src/gitlab/gitlab_new_service.ts:569
Somehow the GraphQL CreateNote mutation fails if there is no actual comment in the body. I couldn’t find the exact line where the error is thrown but we should either use a different mutation (if possible?) or fix this in the main repo.
