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

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
parents 89c7db6a 13858d68
---
title: Accept issue new as command to create an issue
merge_request:
author:
...@@ -4,11 +4,11 @@ module Gitlab ...@@ -4,11 +4,11 @@ module Gitlab
def self.match(text) def self.match(text)
# we can not match \n with the dot by passing the m modifier as than # we can not match \n with the dot by passing the m modifier as than
# the title and description are not seperated # 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 end
def self.help_message def self.help_message
'issue create <title>\n<description>' 'issue new <title>\n<description>'
end end
def self.allowed?(project, user) def self.allowed?(project, user)
......
...@@ -57,5 +57,12 @@ describe Gitlab::ChatCommands::IssueCreate, service: true do ...@@ -57,5 +57,12 @@ describe Gitlab::ChatCommands::IssueCreate, service: true do
expect(match[:title]).to eq('my title') expect(match[:title]).to eq('my title')
expect(match[:description]).to eq('description') expect(match[:description]).to eq('description')
end 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
end end
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