Commit fc035011 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch 'zj-slash-commands-improvements' into 'master'

Slash commands improvements

See merge request !7638
parents 838c1aad d71ad49f
...@@ -2,7 +2,7 @@ module Gitlab ...@@ -2,7 +2,7 @@ module Gitlab
module ChatCommands module ChatCommands
class IssueShow < IssueCommand class IssueShow < IssueCommand
def self.match(text) def self.match(text)
/\Aissue\s+show\s+(?<iid>\d+)/.match(text) /\Aissue\s+show\s+#{Issue.reference_prefix}?(?<iid>\d+)/.match(text)
end end
def self.help_message def self.help_message
......
...@@ -19,6 +19,14 @@ describe Gitlab::ChatCommands::IssueShow, service: true do ...@@ -19,6 +19,14 @@ describe Gitlab::ChatCommands::IssueShow, service: true do
it 'returns the issue' do it 'returns the issue' do
expect(subject.iid).to be issue.iid expect(subject.iid).to be issue.iid
end end
context 'when its reference is given' do
let(:regex_match) { described_class.match("issue show #{issue.to_reference}") }
it 'shows the issue' do
expect(subject.iid).to be issue.iid
end
end
end end
context 'the issue does not exist' do context 'the issue does not exist' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment