diff options
Diffstat (limited to 'app/services/members/authorized_destroy_service.rb')
-rw-r--r-- | app/services/members/authorized_destroy_service.rb | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/app/services/members/authorized_destroy_service.rb b/app/services/members/authorized_destroy_service.rb index f846d72498f..de3a252d6c6 100644 --- a/app/services/members/authorized_destroy_service.rb +++ b/app/services/members/authorized_destroy_service.rb @@ -26,30 +26,30 @@ module Members def unassign_issues_and_merge_requests(member) if member.is_a?(GroupMember) - issues = Issue.unscoped.select(1). - joins(:project). - where('issues.id = issue_assignees.issue_id AND projects.namespace_id = ?', member.source_id) + issues = Issue.unscoped.select(1) + .joins(:project) + .where('issues.id = issue_assignees.issue_id AND projects.namespace_id = ?', member.source_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 + IssueAssignee.unscoped + .where('user_id = :user_id AND EXISTS (:sub)', user_id: member.user_id, sub: issues) + .delete_all - MergeRequestsFinder.new(user, group_id: member.source_id, assignee_id: member.user_id). - execute. - update_all(assignee_id: nil) + MergeRequestsFinder.new(user, group_id: member.source_id, assignee_id: member.user_id) + .execute + .update_all(assignee_id: nil) else project = member.source # SELECT 1 FROM issues WHERE issues.id = issue_assignees.issue_id AND issues.project_id = X - issues = Issue.unscoped.select(1). - where('issues.id = issue_assignees.issue_id'). - where(project_id: project.id) + issues = Issue.unscoped.select(1) + .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 + 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) end |