Merge branch 'close-issues-by-mr' into 'master'
Close issues mentioned in MR description when MR is merged using fast-forward merge or when merge commit message is edited. Fixes gitlab-org/gitlab-ee#48. See merge request !1639
This commit is contained in:
commit
c9edffcba6
2 changed files with 11 additions and 0 deletions
|
@ -5,6 +5,7 @@ v 8.2.0 (unreleased)
|
|||
- Highlight comment based on anchor in URL
|
||||
|
||||
v 8.1.0 (unreleased)
|
||||
- Fix bug preventing mentioned issued from being closed when MR is merged using fast-forward merge.
|
||||
- Fix nonatomic database update potentially causing project star counts to go negative (Stan Hu)
|
||||
- Fix error preventing displaying of commit data for a directory with a leading dot (Stan Hu)
|
||||
- Speed up load times of issue detail pages by roughly 1.5x
|
||||
|
|
|
@ -6,6 +6,7 @@ module MergeRequests
|
|||
#
|
||||
class PostMergeService < MergeRequests::BaseService
|
||||
def execute(merge_request)
|
||||
close_issues(merge_request)
|
||||
merge_request.mark_as_merged
|
||||
create_merge_event(merge_request, current_user)
|
||||
create_note(merge_request)
|
||||
|
@ -15,6 +16,15 @@ module MergeRequests
|
|||
|
||||
private
|
||||
|
||||
def close_issues(merge_request)
|
||||
return unless merge_request.target_branch == project.default_branch
|
||||
|
||||
closed_issues = merge_request.closes_issues(current_user)
|
||||
closed_issues.each do |issue|
|
||||
Issues::CloseService.new(project, current_user, {}).execute(issue, merge_request)
|
||||
end
|
||||
end
|
||||
|
||||
def create_merge_event(merge_request, current_user)
|
||||
EventCreateService.new.merge_mr(merge_request, current_user)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue