gitlab-org--gitlab-foss/lib/gitlab/closing_issue_extractor.rb
Vinnie Okada 2c46c4523f Track projects in ReferenceExtractor
Store both the project and identifier of extracted references.  This
prevents `ReferenceExtractor` from returning objects in the wrong
project for cross-project references.
2014-10-03 12:30:20 -05:00

16 lines
426 B
Ruby

module Gitlab
module ClosingIssueExtractor
ISSUE_CLOSING_REGEX = Regexp.new(Gitlab.config.gitlab.issue_closing_pattern)
def self.closed_by_message_in_project(message, project)
md = ISSUE_CLOSING_REGEX.match(message)
if md
extractor = Gitlab::ReferenceExtractor.new
extractor.analyze(md[0], project)
extractor.issues_for(project)
else
[]
end
end
end
end