Merge Request auto close issues now checked on merge
What does this MR do and why?
Before we would not create merge_requests_closing_issues
in the DB if the referenced issues's project had
autoclose_referenced_issues
disabled. Now we create the records in
the DB even if it is disabled, but we check that the setting is
enabled on the project before closing each issue when the MR is merged.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
Before this MR
- Disable the project setting in Settings -> Repository -> Branch defaults -> Auto-close referenced issues on default branch
- Use the closing pattern in a merge request description. Like
Closes #2
where 2 is the IID of an open issue. - In the rails console check that a record was not created
MergeRequestsClosingIssues.last
- Enable the project setting in Settings -> Repository -> Branch defaults -> Auto-close referenced issues on default branch
- Update the MR's description to something different (you can simply append something to the existing closing pattern)
- In the rails console check that a record was created
MergeRequestsClosingIssues.last
- Disable the project setting in Settings -> Repository -> Branch defaults -> Auto-close referenced issues on default branch
- Merge the merge request and issue
#2
will be closed anyway
After this MR
- Disable the project setting in Settings -> Repository -> Branch defaults -> Auto-close referenced issues on default branch
- Use the closing pattern in a merge request description. Like
Closes #2
where 2 is the IID of an open issue. - In the rails console check that a record was created
MergeRequestsClosingIssues.last
- Merge the merge request and issue
#2
wont be closed because the setting is disabled
Related to #468223
Edited by Mario Celi