Welcome to mirror list, hosted at ThFree Co, Russian Federation.

closing_issue_extractor.rb « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ab184d95c052587c3cf848245386335652fe5202 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
module Gitlab
  class ClosingIssueExtractor
    ISSUE_CLOSING_REGEX = Regexp.new(Gitlab.config.gitlab.issue_closing_pattern)

    def initialize(project, current_user = nil)
      @extractor = Gitlab::ReferenceExtractor.new(project, current_user)
    end

    def closed_by_message(message)
      return [] if message.nil?
      
      closing_statements = message.scan(ISSUE_CLOSING_REGEX).
        map { |ref| ref[0] }.join(" ")

      @extractor.analyze(closing_statements)

      @extractor.issues
    end
  end
end