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
0a3507e1
Commit
0a3507e1
authored
Jun 01, 2017
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address review comments
parent
a9dc6d28
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
26 deletions
+26
-26
app/services/slash_commands/interpret_service.rb
app/services/slash_commands/interpret_service.rb
+18
-22
doc/user/project/slash_commands.md
doc/user/project/slash_commands.md
+6
-2
lib/gitlab/slash_commands/command_definition.rb
lib/gitlab/slash_commands/command_definition.rb
+1
-1
spec/services/slash_commands/interpret_service_spec.rb
spec/services/slash_commands/interpret_service_spec.rb
+1
-1
No files found.
app/services/slash_commands/interpret_service.rb
View file @
0a3507e1
...
...
@@ -92,18 +92,11 @@ module SlashCommands
desc
'Assign'
explanation
do
|
users
|
if
issuable
.
is_a?
(
Issue
)
"Assigns
#{
users
.
map
(
&
:to_reference
).
to_sentence
}
."
if
users
.
any?
else
"Assigns
#{
users
.
last
.
to_reference
}
."
if
users
.
any?
end
users
=
issuable
.
is_a?
(
Issue
)
?
users
:
users
.
take
(
1
)
"Assigns
#{
users
.
map
(
&
:to_reference
).
to_sentence
}
."
end
params
do
if
issuable
.
is_a?
(
Issue
)
[
'@user1 @user2'
]
else
[
'@user'
]
end
issuable
.
is_a?
(
Issue
)
?
'@user1 @user2'
:
'@user'
end
condition
do
current_user
.
can?
(
:"admin_
#{
issuable
.
to_ability_name
}
"
,
project
)
...
...
@@ -122,17 +115,19 @@ module SlashCommands
end
end
desc
'Remove all or specific assignee(s)'
explanation
do
'Removes assignee(s)'
end
params
do
desc
do
if
issuable
.
is_a?
(
Issue
)
[
'@user1 @user2'
]
'Remove all or specific assignee(s)'
else
[]
'Remove assignee'
end
end
explanation
do
"Removes
#{
'assignee'
.
pluralize
(
issuable
.
assignees
.
size
)
}
#{
issuable
.
assignees
.
map
(
&
:to_reference
).
to_sentence
}
"
end
params
do
issuable
.
is_a?
(
Issue
)
?
'@user1 @user2'
:
''
end
condition
do
issuable
.
persisted?
&&
issuable
.
assignees
.
any?
&&
...
...
@@ -142,11 +137,12 @@ module SlashCommands
users
=
extract_users
(
unassign_param
)
if
issuable
.
is_a?
(
Issue
)
if
users
.
any?
@updates
[
:assignee_ids
]
=
issuable
.
assignees
.
pluck
(
:id
)
-
users
.
map
(
&
:id
)
else
@updates
[
:assignee_ids
]
=
[]
end
@updates
[
:assignee_ids
]
=
if
users
.
any?
issuable
.
assignees
.
pluck
(
:id
)
-
users
.
map
(
&
:id
)
else
[]
end
else
@updates
[
:assignee_id
]
=
nil
end
...
...
doc/user/project/slash_commands.md
View file @
0a3507e1
...
...
@@ -16,8 +16,9 @@ do.
|
`/reopen`
| Reopen the issue or merge request |
|
`/merge`
| Merge (when pipeline succeeds) |
|
`/title <New title>`
| Change title |
|
`/assign @username`
| Assign |
|
`/unassign @user1 @user2`
| Remove all the assignees or specified ones |
|
`/assign @user1 @user2 `
| Add assignee(s) |
|
`/reassign @user1 @user2 `
| Change assignee(s) |
|
`/unassign @user1 @user2`
| Remove all or specific assignee(s) |
|
`/milestone %milestone`
| Set milestone |
|
`/remove_milestone`
| Remove milestone |
|
`/label ~foo ~"bar baz"`
| Add label(s) |
...
...
@@ -39,3 +40,6 @@ do.
|
`/weight <1-9>`
| Set the weight of the issue |
|
`/clear_weight`
| Clears the issue weight |
|
`/board_move ~column`
| Move issue to column on the board |
Note: In GitLab EES every issue can have more than one assignee, so commands
`/assign`
,
`/unassign`
and
`/reassign`
support multiple assignees.
lib/gitlab/slash_commands/command_definition.rb
View file @
0a3507e1
...
...
@@ -57,7 +57,7 @@ module Gitlab
prms
=
params
if
prms
.
respond_to?
(
:call
)
prms
=
context
.
instance_exec
(
&
prms
)
rescue
''
prms
=
Array
(
context
.
instance_exec
(
&
prms
))
rescue
params
end
{
...
...
spec/services/slash_commands/interpret_service_spec.rb
View file @
0a3507e1
...
...
@@ -947,7 +947,7 @@ describe SlashCommands::InterpretService, services: true do
it
'includes current assignee reference'
do
_
,
explanations
=
service
.
explain
(
content
,
issue
)
expect
(
explanations
).
to
eq
([
'Removes assignee(s)'
])
expect
(
explanations
).
to
eq
([
"Removes assignee
#{
developer
.
to_reference
}
"
])
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