Commit 3e92216f authored by Alexandru Croitor's avatar Alexandru Croitor

Ensure to run unassign issuables worker when not in a transaction

parent 90278c06
......@@ -69,7 +69,7 @@ module Members
def enqueue_unassign_issuables(member)
source_type = member.is_a?(GroupMember) ? 'Group' : 'Project'
member.run_after_commit do
member.run_after_commit_or_now do
MembersDestroyer::UnassignIssuablesWorker.perform_async(member.user_id, member.source_id, source_type)
end
end
......
---
title: Ensure to run unassign issuables worker when not in a transaction
merge_request: 36680
author:
type: fixed
......@@ -25,6 +25,7 @@ RSpec.describe Members::DestroyService do
before do
type = member.is_a?(GroupMember) ? 'Group' : 'Project'
expect(TodosDestroyer::EntityLeaveWorker).to receive(:perform_in).with(Todo::WAIT_FOR_DELETE, member.user_id, member.source_id, type)
expect(MembersDestroyer::UnassignIssuablesWorker).to receive(:perform_async).with(member.user_id, member.source_id, type) if opts[:unassign_issuables]
end
it 'destroys the member' 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