Slash command comment without changes triggers webhooks with emtpy changes
Summary
When using slash commands to update an issue, a webhook can be configured to be executed.
However, if you are using slash commands to set the same state as the issue already has, a webhook is also triggered, but does not contain changes (as there are none).
In my opinion a webhook should not fire if there are no changes (to the state of the issue or adding a comment) caused by a comment which consists only of slash-actions.
Steps to reproduce
- Create an issue and apply a given label and set a health status.
- Setup a web hook with the
issue eventssubscription. - Create a comment with nothing but a slash command also setting this label and the same health status.
- You'll see that the issue is not updated as expected (neither are timestamps), but a webhook with the
issue eventssubscription will receive a call with an emptychangeskey.
In my exact case, it was a confidential issue, with the confidential issue events subscription, and the slash commands were issued in an internal note to the issue.
Example Project
What is the current bug behavior?
Currently GitLab will send a webhook with empty changes, even though GitLab timestamps for the issue are not updated and no events are visible when looking at the issue.
What is the expected correct behavior?
I still expect the updated at timestamps in GitLab to not change, but I would expect a webhook to not be sent out if there are no changes.
So if the changes array is empty, a webhook should not fire.
Relevant logs and/or screenshots
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
v16.2.2-ee
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)(we will only investigate if the tests are passing)
Possible fixes
The webhook should be evaluated, but once it is detected that the comment did not trigger any changes to the issue, the webhook should stop and not be fired.