Unassign quick action handles arguments incorrectly
Summary
The unassign
quick-action does not handle bad arguments correctly. If the argument is
not a valid username, then all reviewers are removed. This is probably not the intention.
I spotted this when I fat-fingered /unassign_reviewer me
as /unassign_reviewer mr
and both
reviewers were removed.
Steps to reproduce
- Create a merge request, assign two users.
- Add a note with the text
/assign self
See that both reviewers are removed.
Example Project
This occurs on any project.
What is the current bug behavior?
All reviewers are removed.
What is the expected correct behavior?
No reviewers are removed, the note is not added and an error message is displayed to the user.
We should only remove all reviewers if the command is exactly /unassign_reviewers
or /unassign_reviewer
without
any following non-whitespace text.
Output of checks
This bug happens on GitLab.com
Possible fixes
Change the code at quick_actions/merge_request_actions.rb to check to see if any params were passed, and error if any parameter failed to parse correctly.