diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2016-12-05 10:50:44 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2016-12-05 10:50:44 +0000 |
commit | ca075c918a2eceaa02fa8b2ff2da4434c0900b2d (patch) | |
tree | cc5fbc29f9e94e61c6a8cbfa3d1db8ef36c99da7 | |
parent | 89c7db6aec2e9f893fb5411f4341230015f840d9 (diff) | |
parent | 13858d6873afb1168247f79c183ad8260bf4ccf4 (diff) | |
download | gitlab-ce-ca075c918a2eceaa02fa8b2ff2da4434c0900b2d.tar.gz |
Merge branch 'zj-issue-new-over-issue-create' into 'master'
Accept `issue new` as command to create an issue
Checkout commit message: 629eb073c2056d0e4d87aefea83d5d384465bee6
cc @pedroms
See merge request !7787
-rw-r--r-- | changelogs/unreleased/zj-issue-new-over-issue-create.yml | 4 | ||||
-rw-r--r-- | lib/gitlab/chat_commands/issue_create.rb | 4 | ||||
-rw-r--r-- | spec/lib/gitlab/chat_commands/issue_create_spec.rb | 7 |
3 files changed, 13 insertions, 2 deletions
diff --git a/changelogs/unreleased/zj-issue-new-over-issue-create.yml b/changelogs/unreleased/zj-issue-new-over-issue-create.yml new file mode 100644 index 00000000000..9dd463e4efa --- /dev/null +++ b/changelogs/unreleased/zj-issue-new-over-issue-create.yml @@ -0,0 +1,4 @@ +--- +title: Accept issue new as command to create an issue +merge_request: +author: diff --git a/lib/gitlab/chat_commands/issue_create.rb b/lib/gitlab/chat_commands/issue_create.rb index 99c1382af44..1dba85c1b51 100644 --- a/lib/gitlab/chat_commands/issue_create.rb +++ b/lib/gitlab/chat_commands/issue_create.rb @@ -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) diff --git a/spec/lib/gitlab/chat_commands/issue_create_spec.rb b/spec/lib/gitlab/chat_commands/issue_create_spec.rb index dd07cff9243..6c71e79ff6d 100644 --- a/spec/lib/gitlab/chat_commands/issue_create_spec.rb +++ b/spec/lib/gitlab/chat_commands/issue_create_spec.rb @@ -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 |