2016-11-16 12:28:38 -05:00
|
|
|
module Gitlab
|
2017-05-31 01:50:53 -04:00
|
|
|
module SlashCommands
|
2016-11-16 12:28:38 -05:00
|
|
|
class IssueShow < IssueCommand
|
|
|
|
def self.match(text)
|
2016-11-21 16:27:10 -05:00
|
|
|
/\Aissue\s+show\s+#{Issue.reference_prefix}?(?<iid>\d+)/.match(text)
|
2016-11-16 12:28:38 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def self.help_message
|
|
|
|
"issue show <id>"
|
|
|
|
end
|
|
|
|
|
|
|
|
def execute(match)
|
2017-01-10 13:43:58 -05:00
|
|
|
issue = find_by_iid(match[:iid])
|
|
|
|
|
|
|
|
if issue
|
2017-05-31 01:50:53 -04:00
|
|
|
Gitlab::SlashCommands::Presenters::IssueShow.new(issue).present
|
2017-01-10 13:43:58 -05:00
|
|
|
else
|
2017-05-31 01:50:53 -04:00
|
|
|
Gitlab::SlashCommands::Presenters::Access.new.not_found
|
2017-01-10 13:43:58 -05:00
|
|
|
end
|
2016-11-16 12:28:38 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|