only look for issues mentioned on description on MergeRequest#issues_mentioned_but_not_closing
This commit is contained in:
parent
c1515cd865
commit
0e76daf3da
2 changed files with 5 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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}"
|
||||
|
|
Loading…
Reference in a new issue