gitlab-org--gitlab-foss/lib/gitlab/slash_commands/issue_search.rb

28 lines
647 B
Ruby
Raw Normal View History

# frozen_string_literal: true
module Gitlab
module SlashCommands
class IssueSearch < IssueCommand
def self.match(text)
/\Aissue\s+search\s+(?<query>.*)/.match(text)
end
def self.help_message
"issue search <your query>"
end
# rubocop: disable CodeReuse/ActiveRecord
def execute(match)
issues = collection.search(match[:query]).limit(QUERY_LIMIT)
2017-01-26 09:30:34 -05:00
if issues.present?
Presenters::IssueSearch.new(issues).present
else
2017-01-26 09:30:34 -05:00
Presenters::Access.new(issues).not_found
end
end
# rubocop: enable CodeReuse/ActiveRecord
end
end
end