diff options
author | Gabriel Gizotti <gabriel@gizotti.com> | 2016-11-24 00:50:49 +0300 |
---|---|---|
committer | Gabriel Gizotti <gabriel@gizotti.com> | 2016-12-16 12:13:17 +0300 |
commit | 1a8f43ff3e5481d65f547ac01c03e2d64e14fff0 (patch) | |
tree | db3d96d27fee723ce9225df063a3dbfc219f1468 /app/models/merge_request.rb | |
parent | e52e3ab5082599fd5a895de961b07584421a5cd2 (diff) |
introduce MergeRequest#issues_mentioned_but_not_closing
Diffstat (limited to 'app/models/merge_request.rb')
-rw-r--r-- | app/models/merge_request.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 62dd02936e2..6f660bf0e77 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -568,6 +568,22 @@ class MergeRequest < ActiveRecord::Base end end + def issues_mentioned_but_not_closing(current_user = self.author) + 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 + end + + issues - closes_issues + end + def target_project_path if target_project target_project.path_with_namespace |