summaryrefslogtreecommitdiff
path: root/lib/gitlab/slash_commands/issue_search.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/slash_commands/issue_search.rb')
-rw-r--r--lib/gitlab/slash_commands/issue_search.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/gitlab/slash_commands/issue_search.rb b/lib/gitlab/slash_commands/issue_search.rb
new file mode 100644
index 00000000000..acba84b54b4
--- /dev/null
+++ b/lib/gitlab/slash_commands/issue_search.rb
@@ -0,0 +1,23 @@
+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
+
+ def execute(match)
+ issues = collection.search(match[:query]).limit(QUERY_LIMIT)
+
+ if issues.present?
+ Presenters::IssueSearch.new(issues).present
+ else
+ Presenters::Access.new(issues).not_found
+ end
+ end
+ end
+ end
+end