Accept `issue new` as command to create an issue

Now only `/trigger issue create` is a valid command, but our UI shows
Issue new everywhere. The default now will be `/trigger issue new`. The
help message is adjusted to reflect this.

Fixes: gitlab-org/gitlab-ce#25025
This commit is contained in:
Z.J. van de Weg 2016-11-28 13:18:06 +01:00
parent 89c7db6aec
commit 13858d6873
3 changed files with 13 additions and 2 deletions

View File

@ -0,0 +1,4 @@
---
title: Accept issue new as command to create an issue
merge_request:
author:

View File

@ -4,11 +4,11 @@ module Gitlab
def self.match(text)
# we can not match \n with the dot by passing the m modifier as than
# the title and description are not seperated
/\Aissue\s+create\s+(?<title>[^\n]*)\n*(?<description>(.|\n)*)/.match(text)
/\Aissue\s+(new|create)\s+(?<title>[^\n]*)\n*(?<description>(.|\n)*)/.match(text)
end
def self.help_message
'issue create <title>\n<description>'
'issue new <title>\n<description>'
end
def self.allowed?(project, user)

View File

@ -57,5 +57,12 @@ describe Gitlab::ChatCommands::IssueCreate, service: true do
expect(match[:title]).to eq('my title')
expect(match[:description]).to eq('description')
end
it 'matches the alias new' do
match = described_class.match("issue new my title")
expect(match).not_to be_nil
expect(match[:title]).to eq('my title')
end
end
end