diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-05-12 15:37:18 +0300 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-05-12 15:37:18 +0300 |
commit | 592263ead99a13513adbee9d1bf041e9098763f2 (patch) | |
tree | bc089331239c7b7919c68603ff7562da9b23b227 /app/services | |
parent | 8f47540ab828a429b0f14c64e54fcc9ff0862e95 (diff) | |
parent | e2a3a5095abd8c1fa57dd19e4ff693ae4021fde8 (diff) |
Merge branch 'update_assignee_cache_counts_refactoring' into 'master'
Rework update_assignee_cache_counts
Closes #31873
See merge request !11270
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/issuable_base_service.rb | 6 | ||||
-rw-r--r-- | app/services/members/authorized_destroy_service.rb | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/app/services/issuable_base_service.rb b/app/services/issuable_base_service.rb index c1e532b504a..dc2ab99b982 100644 --- a/app/services/issuable_base_service.rb +++ b/app/services/issuable_base_service.rb @@ -178,6 +178,7 @@ class IssuableBaseService < BaseService after_create(issuable) issuable.create_cross_references!(current_user) execute_hooks(issuable) + issuable.assignees.each(&:invalidate_cache_counts) end issuable @@ -234,6 +235,11 @@ class IssuableBaseService < BaseService old_assignees: old_assignees ) + if old_assignees != issuable.assignees + assignees = old_assignees + issuable.assignees.to_a + assignees.compact.each(&:invalidate_cache_counts) + end + after_update(issuable) issuable.create_new_cross_references!(current_user) execute_hooks(issuable, 'update') diff --git a/app/services/members/authorized_destroy_service.rb b/app/services/members/authorized_destroy_service.rb index a85b9465c84..7912cac65d3 100644 --- a/app/services/members/authorized_destroy_service.rb +++ b/app/services/members/authorized_destroy_service.rb @@ -43,8 +43,9 @@ module Members ) project.merge_requests.opened.assigned_to(member.user).update_all(assignee_id: nil) - member.user.update_cache_counts end + + member.user.invalidate_cache_counts end end end |