2014-06-13 10:19:08 -04:00
|
|
|
module Gitlab
|
|
|
|
module ClosingIssueExtractor
|
|
|
|
ISSUE_CLOSING_REGEX = Regexp.new(Gitlab.config.gitlab.issue_closing_pattern)
|
|
|
|
|
|
|
|
def self.closed_by_message_in_project(message, project)
|
2014-09-17 13:08:35 -04:00
|
|
|
issues = []
|
|
|
|
|
|
|
|
unless message.nil?
|
|
|
|
md = message.scan(ISSUE_CLOSING_REGEX)
|
|
|
|
|
|
|
|
md.each do |ref|
|
|
|
|
extractor = Gitlab::ReferenceExtractor.new
|
|
|
|
extractor.analyze(ref[0], project)
|
|
|
|
issues += extractor.issues_for(project)
|
|
|
|
end
|
2014-06-13 10:19:08 -04:00
|
|
|
end
|
2014-09-17 13:08:35 -04:00
|
|
|
|
|
|
|
issues.uniq
|
2014-06-13 10:19:08 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|