Class: Gitlab::SlashCommands::IssueShow

Inherits:
IssueCommand show all
Defined in:
lib/gitlab/slash_commands/issue_show.rb

Constant Summary

Constants inherited from BaseCommand

BaseCommand::QUERY_LIMIT

Instance Attribute Summary

Attributes inherited from BaseCommand

#chat_name, #current_user, #params, #project

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from IssueCommand

available?, #collection

Methods inherited from BaseCommand

allowed?, available?, can?, #collection, #initialize

Constructor Details

This class inherits a constructor from Gitlab::SlashCommands::BaseCommand

Class Method Details

.help_messageObject


10
11
12
# File 'lib/gitlab/slash_commands/issue_show.rb', line 10

def self.help_message
  "issue show <id>"
end

.match(text) ⇒ Object


6
7
8
# File 'lib/gitlab/slash_commands/issue_show.rb', line 6

def self.match(text)
  /\Aissue\s+show\s+#{Issue.reference_prefix}?(?<iid>\d+)/.match(text)
end

Instance Method Details

#execute(match) ⇒ Object


14
15
16
17
18
19
20
21
22
# File 'lib/gitlab/slash_commands/issue_show.rb', line 14

def execute(match)
  issue = find_by_iid(match[:iid])

  if issue
    Gitlab::SlashCommands::Presenters::IssueShow.new(issue).present
  else
    Gitlab::SlashCommands::Presenters::Access.new.not_found
  end
end