Does not create a task for new issue when assignee is the current user

parent 422a01fc
...@@ -11,7 +11,7 @@ class TaskService ...@@ -11,7 +11,7 @@ class TaskService
# * creates a pending task for assignee if issue is assigned # * creates a pending task for assignee if issue is assigned
# #
def new_issue(issue, current_user) def new_issue(issue, current_user)
if issue.is_assigned? if issue.is_assigned? && issue.assignee != current_user
create_task(issue.project, issue, current_user, issue.assignee, Task::ASSIGNED) create_task(issue.project, issue, current_user, issue.assignee, Task::ASSIGNED)
end end
end end
......
...@@ -25,6 +25,10 @@ describe TaskService, services: true do ...@@ -25,6 +25,10 @@ describe TaskService, services: true do
it 'does not create a task if unassigned' do it 'does not create a task if unassigned' do
is_expected_to_not_create_task { service.new_issue(unassigned_issue, author) } is_expected_to_not_create_task { service.new_issue(unassigned_issue, author) }
end end
it 'does not create a task if assignee is the current user' do
is_expected_to_not_create_task { service.new_issue(unassigned_issue, john_doe) }
end
end end
describe '#reassigned_issue' do describe '#reassigned_issue' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment