Skip to content
GitLab
Next
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
GitLab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
4
Snippets
Groups
Projects
Show more breadcrumbs
GitLab.org
GitLab
Commits
3ff05756
There was an error fetching the commit references. Please try again later.
Commit
3ff05756
authored
8 years ago
by
Z.J. van de Weg
Browse files
Options
Downloads
Patches
Plain Diff
Issue creation now accepts trailing whitespace
parent
60c2d590
No related branches found
No related tags found
1 merge request
!912
CE upstream
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/gitlab/chat_commands/issue_create.rb
+4
-2
4 additions, 2 deletions
lib/gitlab/chat_commands/issue_create.rb
spec/lib/gitlab/chat_commands/issue_create_spec.rb
+9
-0
9 additions, 0 deletions
spec/lib/gitlab/chat_commands/issue_create_spec.rb
with
13 additions
and
2 deletions
lib/gitlab/chat_commands/issue_create.rb
+
4
−
2
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 @@ def self.allowed?(project, user)
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
...
...
This diff is collapsed.
Click to expand it.
spec/lib/gitlab/chat_commands/issue_create_spec.rb
+
9
−
0
View file @
3ff05756
...
...
@@ -32,6 +32,15 @@
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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment