summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZ.J. van de Weg <git@zjvandeweg.nl>2016-11-21 22:27:10 +0100
committerZ.J. van de Weg <git@zjvandeweg.nl>2016-11-25 12:33:57 +0100
commitd71ad49fc570ef617d0bbf99af53596ef5d48892 (patch)
tree200f2ec04893396077cba24afccccf9a0234afdc
parent2914fa3919a4d8fa12758d66793478a485ad5335 (diff)
downloadgitlab-ce-d71ad49fc570ef617d0bbf99af53596ef5d48892.tar.gz
Accept a valid ref for issue show
For example, now we support `/gitlab issue show #1`. Where the # used to trip the regex.
-rw-r--r--lib/gitlab/chat_commands/issue_show.rb2
-rw-r--r--spec/lib/gitlab/chat_commands/issue_show_spec.rb8
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/gitlab/chat_commands/issue_show.rb b/lib/gitlab/chat_commands/issue_show.rb
index f5bceb038e5..2a45d49cf6b 100644
--- a/lib/gitlab/chat_commands/issue_show.rb
+++ b/lib/gitlab/chat_commands/issue_show.rb
@@ -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
diff --git a/spec/lib/gitlab/chat_commands/issue_show_spec.rb b/spec/lib/gitlab/chat_commands/issue_show_spec.rb
index 331a4604e9b..2eab73e49e5 100644
--- a/spec/lib/gitlab/chat_commands/issue_show_spec.rb
+++ b/spec/lib/gitlab/chat_commands/issue_show_spec.rb
@@ -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