summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorValery Sizov <valery@gitlab.com>2017-05-05 13:41:35 +0300
committerValery Sizov <valery@gitlab.com>2017-05-05 15:30:19 +0300
commit34be1835af2913c86bc468131e6bcbd530daf48d (patch)
tree67122da950643c4f91791bfb007636c16db774c3 /app
parentc4094b7ec4699811f928699ad67c90e1686da6e2 (diff)
downloadgitlab-ce-34be1835af2913c86bc468131e6bcbd530daf48d.tar.gz
[Multiple issue assignee] Fix a number of specs
Diffstat (limited to 'app')
-rw-r--r--app/models/concerns/issuable.rb1
-rw-r--r--app/services/members/authorized_destroy_service.rb15
-rw-r--r--app/services/system_note_service.rb2
3 files changed, 12 insertions, 6 deletions
diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb
index edf4e9e5d78..16f04305a43 100644
--- a/app/models/concerns/issuable.rb
+++ b/app/models/concerns/issuable.rb
@@ -94,7 +94,6 @@ module Issuable
acts_as_paranoid
- after_save :update_assignee_cache_counts, if: :assignee_id_changed?
after_save :record_metrics, unless: :imported?
# We want to use optimistic lock for cases when only title or description are involved
diff --git a/app/services/members/authorized_destroy_service.rb b/app/services/members/authorized_destroy_service.rb
index 1711be7211c..a85b9465c84 100644
--- a/app/services/members/authorized_destroy_service.rb
+++ b/app/services/members/authorized_destroy_service.rb
@@ -26,15 +26,22 @@ module Members
def unassign_issues_and_merge_requests(member)
if member.is_a?(GroupMember)
- IssuesFinder.new(user, group_id: member.source_id, assignee_id: member.user_id).
- execute.
- update_all(assignee_id: nil)
+ issue_ids = IssuesFinder.new(user, group_id: member.source_id, assignee_id: member.user_id).
+ execute.pluck(:id)
+
+ IssueAssignee.destroy_all(issue_id: issue_ids, user_id: member.user_id)
+
MergeRequestsFinder.new(user, group_id: member.source_id, assignee_id: member.user_id).
execute.
update_all(assignee_id: nil)
else
project = member.source
- project.issues.opened.assigned_to(member.user).update_all(assignee_id: nil)
+
+ IssueAssignee.destroy_all(
+ user_id: member.user_id,
+ issue_id: project.issues.opened.assigned_to(member.user).select(:id)
+ )
+
project.merge_requests.opened.assigned_to(member.user).update_all(assignee_id: nil)
member.user.update_cache_counts
end
diff --git a/app/services/system_note_service.rb b/app/services/system_note_service.rb
index 1dee791cfd6..fb1f56c9cc6 100644
--- a/app/services/system_note_service.rb
+++ b/app/services/system_note_service.rb
@@ -84,7 +84,7 @@ module SystemNoteService
"assigned to #{issue.assignees.map(&:to_reference).to_sentence}"
end
- NoteSummary.new(issue, project, author, body, action: 'assignee')
+ create_note(NoteSummary.new(issue, project, author, body, action: 'assignee'))
end
# Called when one or more labels on a Noteable are added and/or removed