Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
3ff05756
Commit
3ff05756
authored
Nov 21, 2016
by
Z.J. van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue creation now accepts trailing whitespace
parent
60c2d590
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
lib/gitlab/chat_commands/issue_create.rb
lib/gitlab/chat_commands/issue_create.rb
+4
-2
spec/lib/gitlab/chat_commands/issue_create_spec.rb
spec/lib/gitlab/chat_commands/issue_create_spec.rb
+9
-0
No files found.
lib/gitlab/chat_commands/issue_create.rb
View file @
3ff05756
...
...
@@ -2,7 +2,9 @@ module Gitlab
module
ChatCommands
class
IssueCreate
<
IssueCommand
def
self
.
match
(
text
)
/\Aissue\s+create\s+(?<title>[^\n]*)\n*(?<description>.*)\z/
.
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
)
end
def
self
.
help_message
...
...
@@ -15,7 +17,7 @@ module Gitlab
def
execute
(
match
)
title
=
match
[
:title
]
description
=
match
[
:description
]
description
=
match
[
:description
]
.
to_s
.
rstrip
Issues
::
CreateService
.
new
(
project
,
current_user
,
title:
title
,
description:
description
).
execute
end
...
...
spec/lib/gitlab/chat_commands/issue_create_spec.rb
View file @
3ff05756
...
...
@@ -32,6 +32,15 @@ describe Gitlab::ChatCommands::IssueCreate, service: true do
expect
(
Issue
.
last
.
description
).
to
eq
(
description
)
end
end
context
"with more newlines between the title and the description"
do
let
(
:description
)
{
"Surfin bird"
}
let
(
:regex_match
)
{
described_class
.
match
(
"issue create bird is the word
\n\n
#{
description
}
\n
"
)
}
it
'creates the issue'
do
expect
{
subject
}.
to
change
{
project
.
issues
.
count
}.
by
(
1
)
end
end
end
describe
'.match'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment