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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
8bb15838
Commit
8bb15838
authored
Apr 24, 2018
by
Athar Hameed
Committed by
Sean McGivern
Apr 24, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[EE] Fix unassign slash command preview
parent
687f5788
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
2 deletions
+45
-2
app/services/quick_actions/interpret_service.rb
app/services/quick_actions/interpret_service.rb
+4
-2
changelogs/unreleased/4950-unassign-slash-command-preview-fix.yml
...gs/unreleased/4950-unassign-slash-command-preview-fix.yml
+5
-0
ee/spec/services/quick_actions/interpret_service_spec.rb
ee/spec/services/quick_actions/interpret_service_spec.rb
+36
-0
No files found.
app/services/quick_actions/interpret_service.rb
View file @
8bb15838
...
...
@@ -139,8 +139,10 @@ module QuickActions
'Remove assignee'
end
end
explanation
do
"Removes
#{
'assignee'
.
pluralize
(
issuable
.
assignees
.
size
)
}
#{
issuable
.
assignees
.
map
(
&
:to_reference
).
to_sentence
}
."
explanation
do
|
users
=
nil
|
assignees
=
issuable
.
assignees
assignees
&=
users
if
users
.
present?
&&
issuable
.
allows_multiple_assignees?
"Removes
#{
'assignee'
.
pluralize
(
assignees
.
size
)
}
#{
assignees
.
map
(
&
:to_reference
).
to_sentence
}
."
end
params
do
issuable
.
allows_multiple_assignees?
?
'@user1 @user2'
:
''
...
...
changelogs/unreleased/4950-unassign-slash-command-preview-fix.yml
0 → 100644
View file @
8bb15838
---
title
:
Fix unassign slash command preview
merge_request
:
18447
author
:
type
:
fixed
ee/spec/services/quick_actions/interpret_service_spec.rb
View file @
8bb15838
...
...
@@ -4,6 +4,7 @@ describe QuickActions::InterpretService do
let
(
:user
)
{
create
(
:user
)
}
let
(
:developer
)
{
create
(
:user
)
}
let
(
:developer2
)
{
create
(
:user
)
}
let
(
:developer3
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:service
)
{
described_class
.
new
(
project
,
developer
)
}
...
...
@@ -115,4 +116,39 @@ describe QuickActions::InterpretService do
end
end
end
describe
'#explain'
do
describe
'unassign command'
do
let
(
:content
)
{
'/unassign'
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
assignees:
[
developer
,
developer2
])
}
it
"includes all assignees' references"
do
_
,
explanations
=
service
.
explain
(
content
,
issue
)
expect
(
explanations
).
to
eq
([
"Removes assignees @
#{
developer
.
username
}
and @
#{
developer2
.
username
}
."
])
end
end
describe
'unassign command with assignee references'
do
let
(
:content
)
{
"/unassign @
#{
developer
.
username
}
@
#{
developer3
.
username
}
"
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
assignees:
[
developer
,
developer2
,
developer3
])
}
it
'includes only selected assignee references'
do
_
,
explanations
=
service
.
explain
(
content
,
issue
)
expect
(
explanations
).
to
eq
([
"Removes assignees @
#{
developer
.
username
}
and @
#{
developer3
.
username
}
."
])
end
end
describe
'unassign command with non-existent assignee reference'
do
let
(
:content
)
{
"/unassign @
#{
developer
.
username
}
@
#{
developer3
.
username
}
"
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
assignees:
[
developer
,
developer2
])
}
it
'ignores non-existent assignee references'
do
_
,
explanations
=
service
.
explain
(
content
,
issue
)
expect
(
explanations
).
to
eq
([
"Removes assignee @
#{
developer
.
username
}
."
])
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