Does not create a task if new assignee is the current user

parent 1d476b06
......@@ -125,7 +125,6 @@ class TaskService
mentioned_users.delete(author)
mentioned_users.delete(target.assignee) if target.respond_to?(:assignee)
mentioned_users.uniq
end
......@@ -149,9 +148,9 @@ class TaskService
end
end
def reassigned_issuable(issuable, user)
if issuable.is_assigned?
create_task(issuable.project, issuable, user, issuable.assignee, Task::ASSIGNED)
def reassigned_issuable(issuable, current_user)
if issuable.is_assigned? && issuable.assignee != current_user
create_task(issuable.project, issuable, current_user, issuable.assignee, Task::ASSIGNED)
end
end
end
......@@ -76,6 +76,12 @@ describe TaskService, services: true do
should_not_create_any_task { service.reassigned_issue(issue, author) }
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
describe '#mark_pending_tasks_as_done' do
......@@ -203,6 +209,12 @@ describe TaskService, services: true do
should_not_create_any_task { service.reassigned_merge_request(mr_assigned, author) }
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
describe '#merge_merge_request' 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