Skip to content
Snippets Groups Projects
Commit 28f67a5d authored by Z.J. van de Weg's avatar Z.J. van de Weg
Browse files

Accept a valid ref for issue show

For example, now we support `/gitlab issue show #1`. Where the # used
to trip the regex.
parent 77a43827
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -2,7 +2,7 @@ module Gitlab
module ChatCommands
class IssueShow < IssueCommand
def self.match(text)
/\Aissue\s+show\s+(?<iid>\d+)/.match(text)
/\Aissue\s+show\s+#{Issue.reference_prefix}?(?<iid>\d+)/.match(text)
end
 
def self.help_message
Loading
Loading
Loading
Loading
@@ -19,6 +19,14 @@ describe Gitlab::ChatCommands::IssueShow, service: true do
it 'returns the issue' do
expect(subject.iid).to be issue.iid
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
 
context 'the issue does not exist' do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment