Commit c9edffcb authored by Robert Speicher's avatar Robert Speicher

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
parents a148c06c d12e49c5
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment