summaryrefslogtreecommitdiff
path: root/lib/gitlab/slash_commands/issue_show.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/slash_commands/issue_show.rb')
-rw-r--r--lib/gitlab/slash_commands/issue_show.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/gitlab/slash_commands/issue_show.rb b/lib/gitlab/slash_commands/issue_show.rb
new file mode 100644
index 00000000000..ffa5184e5cb
--- /dev/null
+++ b/lib/gitlab/slash_commands/issue_show.rb
@@ -0,0 +1,23 @@
+module Gitlab
+ module SlashCommands
+ class IssueShow < IssueCommand
+ def self.match(text)
+ /\Aissue\s+show\s+#{Issue.reference_prefix}?(?<iid>\d+)/.match(text)
+ end
+
+ def self.help_message
+ "issue show <id>"
+ end
+
+ 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
+ end
+ end
+end