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
Jérome Perrin
gitlab-ce
Commits
4120b794
Commit
4120b794
authored
Feb 17, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Does not create a task if new assignee is the current user
parent
1d476b06
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
+15
-4
app/services/task_service.rb
app/services/task_service.rb
+3
-4
spec/services/task_service_spec.rb
spec/services/task_service_spec.rb
+12
-0
No files found.
app/services/task_service.rb
View file @
4120b794
...
@@ -125,7 +125,6 @@ class TaskService
...
@@ -125,7 +125,6 @@ class TaskService
mentioned_users
.
delete
(
author
)
mentioned_users
.
delete
(
author
)
mentioned_users
.
delete
(
target
.
assignee
)
if
target
.
respond_to?
(
:assignee
)
mentioned_users
.
delete
(
target
.
assignee
)
if
target
.
respond_to?
(
:assignee
)
mentioned_users
.
uniq
mentioned_users
.
uniq
end
end
...
@@ -149,9 +148,9 @@ class TaskService
...
@@ -149,9 +148,9 @@ class TaskService
end
end
end
end
def
reassigned_issuable
(
issuable
,
user
)
def
reassigned_issuable
(
issuable
,
current_
user
)
if
issuable
.
is_assigned?
if
issuable
.
is_assigned?
&&
issuable
.
assignee
!=
current_user
create_task
(
issuable
.
project
,
issuable
,
user
,
issuable
.
assignee
,
Task
::
ASSIGNED
)
create_task
(
issuable
.
project
,
issuable
,
current_
user
,
issuable
.
assignee
,
Task
::
ASSIGNED
)
end
end
end
end
end
end
spec/services/task_service_spec.rb
View file @
4120b794
...
@@ -76,6 +76,12 @@ describe TaskService, services: true do
...
@@ -76,6 +76,12 @@ describe TaskService, services: true do
should_not_create_any_task
{
service
.
reassigned_issue
(
issue
,
author
)
}
should_not_create_any_task
{
service
.
reassigned_issue
(
issue
,
author
)
}
end
end
it
'does not create a task if new assignee is the current user'
do
unassigned_issue
.
update_attribute
(
:assignee
,
john_doe
)
should_not_create_any_task
{
service
.
reassigned_issue
(
unassigned_issue
,
john_doe
)
}
end
end
end
describe
'#mark_pending_tasks_as_done'
do
describe
'#mark_pending_tasks_as_done'
do
...
@@ -203,6 +209,12 @@ describe TaskService, services: true do
...
@@ -203,6 +209,12 @@ describe TaskService, services: true do
should_not_create_any_task
{
service
.
reassigned_merge_request
(
mr_assigned
,
author
)
}
should_not_create_any_task
{
service
.
reassigned_merge_request
(
mr_assigned
,
author
)
}
end
end
it
'does not create a task if new assignee is the current user'
do
mr_assigned
.
update_attribute
(
:assignee
,
john_doe
)
should_not_create_any_task
{
service
.
reassigned_merge_request
(
mr_assigned
,
john_doe
)
}
end
end
end
describe
'#merge_merge_request'
do
describe
'#merge_merge_request'
do
...
...
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