Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
63da987f
Commit
63da987f
authored
May 17, 2017
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get rid of pluck in app/services/members/authorized_destroy_service.rb
parent
6a2bcb4b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
app/services/members/authorized_destroy_service.rb
app/services/members/authorized_destroy_service.rb
+7
-3
changelogs/unreleased/get_rid_of_pluck.yml
changelogs/unreleased/get_rid_of_pluck.yml
+4
-0
No files found.
app/services/members/authorized_destroy_service.rb
View file @
63da987f
...
@@ -26,10 +26,14 @@ module Members
...
@@ -26,10 +26,14 @@ module Members
def
unassign_issues_and_merge_requests
(
member
)
def
unassign_issues_and_merge_requests
(
member
)
if
member
.
is_a?
(
GroupMember
)
if
member
.
is_a?
(
GroupMember
)
issue_ids
=
IssuesFinder
.
new
(
user
,
group_id:
member
.
source_id
,
assignee_id:
member
.
user_id
).
issues
=
Issue
.
unscoped
.
select
(
1
).
execute
.
pluck
(
:id
)
joins
(
:project
).
where
(
'issues.id = issue_assignees.issue_id AND projects.namespace_id = ?'
,
member
.
source_id
)
IssueAssignee
.
delete_all
(
issue_id:
issue_ids
,
user_id:
member
.
user_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
MergeRequestsFinder
.
new
(
user
,
group_id:
member
.
source_id
,
assignee_id:
member
.
user_id
).
MergeRequestsFinder
.
new
(
user
,
group_id:
member
.
source_id
,
assignee_id:
member
.
user_id
).
execute
.
execute
.
...
...
changelogs/unreleased/get_rid_of_pluck.yml
0 → 100644
View file @
63da987f
---
title
:
Issue assignees are now removed without loading unnecessary data into memory
merge_request
:
author
:
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment