Rename TaskService#mark_as_done to mark_pending_tasks_as_done

parent 56a5fc0c
......@@ -6,7 +6,7 @@ module Issues
def handle_changes(issue, options = {})
if have_changes?(issue, options)
task_service.mark_as_done(issue, current_user)
task_service.mark_pending_tasks_as_done(issue, current_user)
end
if issue.previous_changes.include?('milestone_id')
......
......@@ -16,7 +16,7 @@ module MergeRequests
def handle_changes(merge_request, options = {})
if have_changes?(merge_request, options)
task_service.mark_as_done(merge_request, current_user)
task_service.mark_pending_tasks_as_done(merge_request, current_user)
end
if merge_request.previous_changes.include?('target_branch')
......
......@@ -19,7 +19,7 @@ class TaskService
# * mark all pending tasks related to the target for the current user as done
#
def close_issue(issue, current_user)
mark_as_done(issue, current_user)
mark_pending_tasks_as_done(issue, current_user)
end
# When we reassign an issue we should:
......@@ -43,7 +43,7 @@ class TaskService
# * mark all pending tasks related to the target for the current user as done
#
def close_merge_request(merge_request, current_user)
mark_as_done(merge_request, current_user)
mark_pending_tasks_as_done(merge_request, current_user)
end
# When we reassign a merge request we should:
......@@ -59,14 +59,14 @@ class TaskService
# * mark all pending tasks related to the target for the current user as done
#
def merge_merge_request(merge_request, current_user)
mark_as_done(merge_request, current_user)
mark_pending_tasks_as_done(merge_request, current_user)
end
# When we mark a task as done we should:
#
# * mark all pending tasks related to the target for the user as done
#
def mark_as_done(target, user)
def mark_pending_tasks_as_done(target, user)
pending_tasks = pending_tasks_for(user, target.project, target)
pending_tasks.update_all(state: :done)
end
......@@ -78,7 +78,7 @@ class TaskService
def new_note(note)
# Skip system notes, like status changes and cross-references
unless note.system
mark_as_done(note.noteable, note.author)
mark_pending_tasks_as_done(note.noteable, note.author)
end
end
......@@ -89,7 +89,7 @@ class TaskService
def update_note(note, current_user)
# Skip system notes, like status changes and cross-references
unless note.system
mark_as_done(note.noteable, current_user)
mark_pending_tasks_as_done(note.noteable, current_user)
end
end
......
......@@ -63,7 +63,7 @@ describe TaskService, services: true do
end
end
describe '#mark_as_done' do
describe '#mark_pending_tasks_as_done' do
let!(:first_pending_task) do
create(:pending_assigned_task, user: john_doe, project: project, target: assigned_issue, author: author)
end
......@@ -73,7 +73,7 @@ describe TaskService, services: true do
end
it 'marks related pending tasks to the target for the user as done' do
service.mark_as_done(assigned_issue, john_doe)
service.mark_pending_tasks_as_done(assigned_issue, john_doe)
expect(first_pending_task.reload).to be_done
expect(second_pending_task.reload).to be_done
......
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