[Rt-commit] [rtir] 03/12: Flush cache when _AddCustomFieldValue on a ticket

Kevin Falcone falcone at bestpractical.com
Mon Apr 14 13:16:44 EDT 2014


This is an automated email from the git hooks/post-receive script.

falcone pushed a commit to branch 3.2/unwrap-hook-lexwrap
in repository rtir.

commit 7ea71046419a41d3a92ce4536a04bcbe4ed41ef8
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Wed Mar 26 13:55:16 2014 -0400

    Flush cache when _AddCustomFieldValue on a ticket
    
    Override at the Ticket rather than Record level.
    Note that this doesn't handle deleting an OCFV.
    This also blows the cache on *any* CF change which is probably wrong.
---
 lib/RT/IR.pm | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/lib/RT/IR.pm b/lib/RT/IR.pm
index 7a03f36..061a88c 100644
--- a/lib/RT/IR.pm
+++ b/lib/RT/IR.pm
@@ -645,11 +645,15 @@ if ( RT::IR->HasConstituency ) {
         $orig_CleanupRequest->();
     };
 
-    require RT::Record;
-    # flush constituency cache on update of the custom field value for a ticket
-    wrap 'RT::Record::_AddCustomFieldValue', pre => sub {
-        return unless UNIVERSAL::isa($_[0] => 'RT::Ticket');
-        $RT::IR::ConstituencyCache{$_[0]->id}  = undef;
+    require RT::Ticket;
+    # flush constituency cache for a ticket when the Constituency CF is updated
+    # RT::Ticket currently uses RT::Record::_AddCustomFieldValue so we just insert not wrap
+    # I wonder what happens when you Delete an OCFV, since it doesn't hit this code path.
+    # This also clears the constituency cache when updating the IP Custom Field, intentional?
+    sub RT::Ticket::_AddCustomFieldValue {
+        my $self = shift;
+        $RT::IR::ConstituencyCache{$self->id}  = undef;
+        return $self->RT::Record::_AddCustomFieldValue(@_);
     };
 
     require RT::Ticket;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the rt-commit mailing list