diff options
author | Valery Sizov <valery@gitlab.com> | 2017-05-10 23:54:10 +0300 |
---|---|---|
committer | Valery Sizov <valery@gitlab.com> | 2017-05-12 14:12:29 +0300 |
commit | e2a3a5095abd8c1fa57dd19e4ff693ae4021fde8 (patch) | |
tree | 435cd38964d20a0b1ad67b9dc02dcdbbe76d00c1 /app/services | |
parent | 92bf7dfcb040e3e035fc87b0a70461f891284c98 (diff) |
Move update_assignee_cache_counts to the service
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 |