summaryrefslogtreecommitdiff
path: root/lib/gitlab/closing_issue_extractor.rb
blob: 401e6e047b16115f61a00901daac460e282ac4bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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