Create or mark task pending as soon the action happens

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