Commit 6a2bcb4b authored by Stan Hu's avatar Stan Hu

Merge branch 'sh-fix-delete-assignees-mysql' into 'master'

Fix deletion of issue assignees for MySQL

See merge request !11426
parents 39baadbd 6ea4d333
...@@ -37,10 +37,15 @@ module Members ...@@ -37,10 +37,15 @@ module Members
else else
project = member.source project = member.source
IssueAssignee.delete_all( # SELECT 1 FROM issues WHERE issues.id = issue_assignees.issue_id AND issues.project_id = X
user_id: member.user_id, issues = Issue.unscoped.select(1).
issue_id: project.issues.opened.assigned_to(member.user).select(:id) where('issues.id = issue_assignees.issue_id').
) where(project_id: project.id)
# DELETE FROM issue_assignees WHERE user_id = X AND EXISTS (...)
IssueAssignee.unscoped.
where('user_id = :user_id AND EXISTS (:sub)', user_id: member.user_id, sub: issues).
delete_all
project.merge_requests.opened.assigned_to(member.user).update_all(assignee_id: nil) project.merge_requests.opened.assigned_to(member.user).update_all(assignee_id: nil)
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