summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Gizotti <gabriel@gizotti.com>2016-11-25 06:49:56 +1000
committerGabriel Gizotti <gabriel@gizotti.com>2016-12-16 19:13:17 +1000
commit0e76daf3da35920d10053dc4d8707e1b6aa7c913 (patch)
tree01a9edced661763e10839ae26c04afbb8704a755
parentc1515cd865ec11110f9b34c41a41747dcbc3b402 (diff)
downloadgitlab-ce-0e76daf3da35920d10053dc4d8707e1b6aa7c913.tar.gz
only look for issues mentioned on description on MergeRequest#issues_mentioned_but_not_closing
-rw-r--r--app/models/merge_request.rb6
-rw-r--r--spec/models/merge_request_spec.rb2
2 files changed, 5 insertions, 3 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index 6f660bf0e77..b8c139d01e2 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -570,18 +570,20 @@ class MergeRequest < ActiveRecord::Base
def issues_mentioned_but_not_closing(current_user = self.author)
issues = []
+ closing_issues = []
if target_branch == project.default_branch
messages = [description]
- messages.concat(commits.map(&:safe_message)) if merge_request_diff
ext = Gitlab::ReferenceExtractor.new(project, current_user)
ext.analyze(messages.join("\n"))
issues = ext.issues
+ closing_issues = Gitlab::ClosingIssueExtractor.new(project, current_user).
+ closed_by_message(messages.join("\n"))
end
- issues - closes_issues
+ issues - closing_issues
end
def target_project_path
diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb
index 688c78fb404..b2c26874552 100644
--- a/spec/models/merge_request_spec.rb
+++ b/spec/models/merge_request_spec.rb
@@ -294,7 +294,7 @@ describe MergeRequest, models: true do
end
end
- it 'detects issues mentioned but not closed' do
+ it 'detects issues mentioned in description but not closed' do
mentioned_issue = create(:issue, project: subject.project)
subject.description = "Is related to #{mentioned_issue.to_reference}"