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
Léo-Paul Géneau
gitlab-ce
Commits
8b8b2edb
Commit
8b8b2edb
authored
Oct 19, 2018
by
Cindy Pallares 🦉
Committed by
Douwe Maan
Oct 19, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "/assign me quick action doesn't work if there is extra white space"
parent
ec0199b8
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
42 deletions
+45
-42
app/services/quick_actions/interpret_service.rb
app/services/quick_actions/interpret_service.rb
+1
-1
changelogs/unreleased/52772-assign-me-quick-action-doesn-t-work-if-there-is-extra-white-space.yml
...ick-action-doesn-t-work-if-there-is-extra-white-space.yml
+5
-0
doc/user/project/quick_actions.md
doc/user/project/quick_actions.md
+1
-0
spec/services/quick_actions/interpret_service_spec.rb
spec/services/quick_actions/interpret_service_spec.rb
+38
-41
No files found.
app/services/quick_actions/interpret_service.rb
View file @
8b8b2edb
...
@@ -643,7 +643,7 @@ module QuickActions
...
@@ -643,7 +643,7 @@ module QuickActions
if
users
.
empty?
if
users
.
empty?
users
=
users
=
if
params
==
'me'
if
params
.
strip
==
'me'
[
current_user
]
[
current_user
]
else
else
User
.
where
(
username:
params
.
split
(
' '
).
map
(
&
:strip
))
User
.
where
(
username:
params
.
split
(
' '
).
map
(
&
:strip
))
...
...
changelogs/unreleased/52772-assign-me-quick-action-doesn-t-work-if-there-is-extra-white-space.yml
0 → 100644
View file @
8b8b2edb
---
title
:
Resolve assign-me quick action doesn't work if there is extra white space
merge_request
:
22402
author
:
type
:
fixed
doc/user/project/quick_actions.md
View file @
8b8b2edb
...
@@ -24,6 +24,7 @@ discussions, and descriptions:
...
@@ -24,6 +24,7 @@ discussions, and descriptions:
|
`/reopen`
| Reopen | ✓ | ✓ |
|
`/reopen`
| Reopen | ✓ | ✓ |
|
`/title <New title>`
| Change title | ✓ | ✓ |
|
`/title <New title>`
| Change title | ✓ | ✓ |
|
`/award :emoji:`
| Toggle emoji award | ✓ | ✓ |
|
`/award :emoji:`
| Toggle emoji award | ✓ | ✓ |
|
`/assign me`
| Assign yourself | ✓ | ✓ |
|
`/assign @user`
| Assign one user | ✓ | ✓ |
|
`/assign @user`
| Assign one user | ✓ | ✓ |
|
`/assign @user1 @user2`
| Assign multiple users
**[STARTER]**
| ✓ | |
|
`/assign @user1 @user2`
| Assign multiple users
**[STARTER]**
| ✓ | |
|
`/unassign`
| Remove assignee(s) | ✓ | ✓ |
|
`/unassign`
| Remove assignee(s) | ✓ | ✓ |
...
...
spec/services/quick_actions/interpret_service_spec.rb
View file @
8b8b2edb
...
@@ -380,6 +380,14 @@ describe QuickActions::InterpretService do
...
@@ -380,6 +380,14 @@ describe QuickActions::InterpretService do
end
end
end
end
shared_examples
'assign command'
do
it
'assigns to a single user'
do
_
,
updates
=
service
.
execute
(
content
,
issuable
)
expect
(
updates
).
to
eq
(
assignee_ids:
[
developer
.
id
])
end
end
it_behaves_like
'reopen command'
do
it_behaves_like
'reopen command'
do
let
(
:content
)
{
'/reopen'
}
let
(
:content
)
{
'/reopen'
}
let
(
:issuable
)
{
issue
}
let
(
:issuable
)
{
issue
}
...
@@ -474,67 +482,56 @@ describe QuickActions::InterpretService do
...
@@ -474,67 +482,56 @@ describe QuickActions::InterpretService do
let
(
:issuable
)
{
issue
}
let
(
:issuable
)
{
issue
}
end
end
context
'assign command'
do
context
'assign command with one user'
do
it_behaves_like
'assign command'
do
let
(
:content
)
{
"/assign @
#{
developer
.
username
}
"
}
let
(
:content
)
{
"/assign @
#{
developer
.
username
}
"
}
let
(
:issuable
)
{
issue
}
context
'Issue'
do
it
'fetches assignee and populates assignee_ids if content contains /assign'
do
_
,
updates
=
service
.
execute
(
content
,
issue
)
expect
(
updates
[
:assignee_ids
]).
to
match_array
([
developer
.
id
])
end
end
end
context
'Merge Request'
do
it_behaves_like
'assign command'
do
it
'fetches assignee and populates assignee_ids if content contains /assign'
do
let
(
:content
)
{
"/assign @
#{
developer
.
username
}
"
}
_
,
updates
=
service
.
execute
(
content
,
merge_request
)
let
(
:issuable
)
{
merge_request
}
expect
(
updates
).
to
eq
(
assignee_ids:
[
developer
.
id
])
end
end
end
end
end
# CE does not have multiple assignees
context
'assign command with multiple assignees'
do
context
'assign command with multiple assignees'
do
let
(
:content
)
{
"/assign @
#{
developer
.
username
}
@
#{
developer2
.
username
}
"
}
before
do
before
do
project
.
add_developer
(
developer2
)
project
.
add_developer
(
developer2
)
end
end
context
'Issue'
do
it_behaves_like
'assign command'
do
it
'fetches assignee and populates assignee_ids if content contains /assign'
do
let
(
:content
)
{
"/assign @
#{
developer
.
username
}
@
#{
developer2
.
username
}
"
}
_
,
updates
=
service
.
execute
(
content
,
issue
)
let
(
:issuable
)
{
issue
}
expect
(
updates
[
:assignee_ids
]).
to
match_array
([
developer
.
id
])
end
end
end
context
'Merge Request'
do
it_behaves_like
'assign command'
do
it
'fetches assignee and populates assignee_ids if content contains /assign'
do
let
(
:content
)
{
"/assign @
#{
developer
.
username
}
@
#{
developer2
.
username
}
"
}
_
,
updates
=
service
.
execute
(
content
,
merge_request
)
let
(
:issuable
)
{
merge_request
}
expect
(
updates
).
to
eq
(
assignee_ids:
[
developer
.
id
])
end
end
end
end
end
context
'assign command with me alias'
do
context
'assign command with me alias'
do
let
(
:content
)
{
"/assign me"
}
it_behaves_like
'assign command'
do
let
(
:content
)
{
'/assign me'
}
context
'Issue'
do
let
(
:issuable
)
{
issue
}
it
'fetches assignee and populates assignee_ids if content contains /assign'
do
end
_
,
updates
=
service
.
execute
(
content
,
issue
)
expect
(
updates
).
to
eq
(
assignee_ids:
[
developer
.
id
])
it_behaves_like
'assign command'
do
let
(
:content
)
{
'/assign me'
}
let
(
:issuable
)
{
merge_request
}
end
end
end
end
context
'Merge Request'
do
context
'assign command with me alias and whitespace'
do
it
'fetches assignee and populates assignee_ids if content contains /assign'
do
it_behaves_like
'assign command'
do
_
,
updates
=
service
.
execute
(
content
,
merge_request
)
let
(
:content
)
{
'/assign me '
}
let
(
:issuable
)
{
issue
}
expect
(
updates
).
to
eq
(
assignee_ids:
[
developer
.
id
])
end
end
it_behaves_like
'assign command'
do
let
(
:content
)
{
'/assign me '
}
let
(
:issuable
)
{
merge_request
}
end
end
end
end
...
...
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