Skip to content
Snippets Groups Projects
Commit 4bfc377f authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre
Browse files

Rename TaskService#mark_as_done to mark_pending_tasks_as_done

parent 56a5fc0c
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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')
Loading
Loading
Loading
Loading
@@ -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')
Loading
Loading
Loading
Loading
@@ -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:
Loading
Loading
@@ -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:
Loading
Loading
@@ -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
Loading
Loading
@@ -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
 
Loading
Loading
@@ -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
 
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment