Class: Gitlab::SlashCommands::IssueSearch
- Inherits:
-
IssueCommand
- Object
- BaseCommand
- IssueCommand
- Gitlab::SlashCommands::IssueSearch
- Defined in:
- lib/gitlab/slash_commands/issue_search.rb
Constant Summary
Constants inherited from BaseCommand
Instance Attribute Summary
Attributes inherited from BaseCommand
#chat_name, #current_user, #params, #project
Class Method Summary collapse
Instance Method Summary collapse
-
#execute(match) ⇒ Object
rubocop: disable CodeReuse/ActiveRecord.
Methods inherited from IssueCommand
Methods inherited from BaseCommand
allowed?, available?, can?, #collection, #initialize
Constructor Details
This class inherits a constructor from Gitlab::SlashCommands::BaseCommand
Class Method Details
.help_message ⇒ Object
10 11 12 |
# File 'lib/gitlab/slash_commands/issue_search.rb', line 10 def self. "issue search <your query>" end |
.match(text) ⇒ Object
6 7 8 |
# File 'lib/gitlab/slash_commands/issue_search.rb', line 6 def self.match(text) /\Aissue\s+search\s+(?<query>.*)/.match(text) end |
Instance Method Details
#execute(match) ⇒ Object
rubocop: disable CodeReuse/ActiveRecord
15 16 17 18 19 20 21 22 23 |
# File 'lib/gitlab/slash_commands/issue_search.rb', line 15 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 |