diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-02-15 16:55:03 -0200 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-02-20 12:10:26 -0200 |
commit | c8f2d18abde050c3b6d15ee32c99495c77b2a222 (patch) | |
tree | 95523dc3f54eb9827dad2f7b507fe021f5cc6f59 | |
parent | 422a01fc853a93e8946c69dc2ad0ad1dea261653 (diff) | |
download | gitlab-ce-c8f2d18abde050c3b6d15ee32c99495c77b2a222.tar.gz |
Does not create a task for new issue when assignee is the current user
-rw-r--r-- | app/services/task_service.rb | 2 | ||||
-rw-r--r-- | spec/services/task_service_spec.rb | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/app/services/task_service.rb b/app/services/task_service.rb index d82bce10eda..35d258a70c2 100644 --- a/app/services/task_service.rb +++ b/app/services/task_service.rb @@ -11,7 +11,7 @@ class TaskService # * creates a pending task for assignee if issue is assigned # 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) end end diff --git a/spec/services/task_service_spec.rb b/spec/services/task_service_spec.rb index ee3c4f8f95d..db9f77fd12d 100644 --- a/spec/services/task_service_spec.rb +++ b/spec/services/task_service_spec.rb @@ -25,6 +25,10 @@ describe TaskService, services: true do it 'does not create a task if unassigned' do is_expected_to_not_create_task { service.new_issue(unassigned_issue, author) } 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 describe '#reassigned_issue' do |