Create or mark task pending as soon the action happens

parent a57bf9bd
......@@ -181,6 +181,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
return
end
TaskService.new.merge_merge_request(merge_request, current_user)
@merge_request.update(merge_error: nil)
if params[:merge_when_build_succeeds].present? && @merge_request.ci_commit && @merge_request.ci_commit.active?
......
......@@ -11,7 +11,6 @@ module MergeRequests
create_merge_event(merge_request, current_user)
create_note(merge_request)
notification_service.merge_mr(merge_request, current_user)
task_service.merge_merge_request(merge_request, current_user)
execute_hooks(merge_request, 'merge')
end
......
......@@ -8,6 +8,7 @@ module Notes
if note.save
# Finish the harder work in the background
NewNoteWorker.perform_in(2.seconds, note.id, params)
TaskService.new.new_note(note, current_user)
end
note
......
......@@ -13,8 +13,6 @@ module Notes
@note.create_cross_references!
execute_note_hooks
end
TaskService.new.new_note(note)
end
def hook_data
......
......@@ -20,7 +20,7 @@ describe Notes::PostProcessService, services: true do
it do
expect(project).to receive(:execute_hooks)
expect(project).to receive(:execute_services)
expect_any_instance_of(TaskService).to receive(:new_note).with(@note)
Notes::PostProcessService.new(@note).execute
end
end
......
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