BigW Consortium Gitlab

issue_search.rb 520 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
module Gitlab
  module ChatCommands
    class IssueSearch < IssueCommand
      def self.match(text)
        /\Aissue\s+search\s+(?<query>.*)/.match(text)
      end

      def self.help_message
        "issue search <your query>"
      end

      def execute(match)
13 14
        issues = collection.search(match[:query]).limit(QUERY_LIMIT)

15 16
        if issues.present?
          Presenters::IssueSearch.new(issues).present
17
        else
18
          Presenters::Access.new(issues).not_found
19
        end
20 21 22 23
      end
    end
  end
end