BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
a713c9c1
Commit
a713c9c1
authored
Nov 22, 2016
by
Kamil Trzciński
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'zj-fix-trailing-whitespace-issue-create' into 'master'
Issue creation now accepts trailing whitespace See merge request !7633
parents
dfb21e29
3ff05756
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
issue_create.rb
lib/gitlab/chat_commands/issue_create.rb
+4
-2
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 @
a713c9c1
...
...
@@ -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 @
a713c9c1
...
...
@@ -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