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
27d32b09
Commit
27d32b09
authored
May 31, 2017
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement reassign command
parent
87451a68
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
0 deletions
+31
-0
app/services/slash_commands/interpret_service.rb
app/services/slash_commands/interpret_service.rb
+15
-0
spec/services/slash_commands/interpret_service_spec.rb
spec/services/slash_commands/interpret_service_spec.rb
+16
-0
No files found.
app/services/slash_commands/interpret_service.rb
View file @
27d32b09
...
...
@@ -141,6 +141,21 @@ module SlashCommands
end
end
desc
'Change assignee(s)'
explanation
do
'Change assignee(s)'
end
params
'@user1 @user2'
condition
do
issuable
.
is_a?
(
Issue
)
&&
issuable
.
persisted?
&&
issuable
.
assignees
.
any?
&&
current_user
.
can?
(
:"admin_
#{
issuable
.
to_ability_name
}
"
,
project
)
end
command
:reassign
do
|
unassign_param
|
@updates
[
:assignee_ids
]
=
extract_users
(
unassign_param
).
map
(
&
:id
)
end
desc
'Set milestone'
explanation
do
|
milestone
|
"Sets the milestone to
#{
milestone
.
to_reference
}
."
if
milestone
...
...
spec/services/slash_commands/interpret_service_spec.rb
View file @
27d32b09
...
...
@@ -455,6 +455,22 @@ describe SlashCommands::InterpretService, services: true do
end
end
context
'reassign command'
do
let
(
:content
)
{
'/reassign'
}
context
'Issue'
do
it
'reassigns user if content contains /reassign @user'
do
user
=
create
(
:user
)
issue
.
update
(
assignee_ids:
[
developer
.
id
,
developer2
.
id
])
_
,
updates
=
service
.
execute
(
"/reassign @
#{
user
.
username
}
"
,
issue
)
expect
(
updates
).
to
eq
(
assignee_ids:
[
user
.
id
])
end
end
end
context
'Merge Request'
do
it
'populates assignee_id: nil if content contains /unassign'
do
merge_request
.
update
(
assignee_id:
developer
.
id
)
...
...
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