Cannot accept a merge request when using JIRA if issue closing pattern is used
Currently, if JIRA integration is enabled and a user includes the issue closing pattern in a merge request description or a commit that is part of a merge request, the merge request cannot be accepted. An error is thrown and the merge request tries to merge indefinitely until the page is reloaded.
After some debugging I found that the reason for this is because the JIRA service currently only expects a
Commit object to be sent when services are executed. However, in the case described above the service is executed and receives the
MergeRequest object. This does not happen if a user uses the issue closing pattern in a commit and pushes directly to the default branch. In this case the
GitPushService passes a
Commit object and all is well.
This issue was already fixed in !45 (merged) but due to merge conflicts cannot be picked directly in to 8-1-stable-ee for a patch. I think the best bet is to pull the bare minimum out of !45 (merged) to make this work with both objects.
I discovered this myself while testing JIRA integration for https://gitlab.zendesk.com/agent/tickets/11034. Then, another customer reported exactly this issue in https://gitlab.zendesk.com/agent/tickets/11214