Skip to content

Commit

Permalink
Fixes #14735 - avoid double sweeping of User topbar cache
Browse files Browse the repository at this point in the history
  • Loading branch information
ares authored and dLobatog committed Apr 27, 2016
1 parent 6b541a0 commit 5a3a739
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/models/user_role.rb
Expand Up @@ -26,7 +26,10 @@ class UserRole < ActiveRecord::Base
:message => N_("has this role already")},
:unless => -> {owner.blank?}

delegate :expire_topbar_cache, :to => :owner
# if we trigger cache clean up by deleting the user, the owner relation target
# does not work since taxable_taxonomy record is already deleted, in this case
# we can ignore expiration since it was expired on User already
delegate :expire_topbar_cache, :to => :owner, :allow_nil => true

def user_role?
self.owner_type == 'User'
Expand Down

0 comments on commit 5a3a739

Please sign in to comment.