[Rt-commit] rt branch, history-filter, updated. rt-3.8.8-89-g28eed92

Shawn Moore sartak at bestpractical.com
Tue Jun 15 15:24:17 EDT 2010


The branch, history-filter has been updated
       via  28eed9213ac73e59e7a0e36d0d2841c35abd5659 (commit)
       via  e8373243a8660811c3f0999899216a9985bdc3a7 (commit)
      from  c70c99885048481a59b7b8d1b0a36a9ad5caa866 (commit)

Summary of changes:
 lib/RT/Transaction_Overlay.pm |   35 +++++++++++++++++++++++++++++++----
 1 files changed, 31 insertions(+), 4 deletions(-)

- Log -----------------------------------------------------------------
commit e8373243a8660811c3f0999899216a9985bdc3a7
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Tue Jun 15 15:09:54 2010 -0400

    Minor!

diff --git a/lib/RT/Transaction_Overlay.pm b/lib/RT/Transaction_Overlay.pm
index f2eeac0..16beaef 100755
--- a/lib/RT/Transaction_Overlay.pm
+++ b/lib/RT/Transaction_Overlay.pm
@@ -351,8 +351,6 @@ use HTML::TreeBuilder;
         },
     },
 );
-
-);
 # }}}
 
 # {{{ sub Create 

commit 28eed9213ac73e59e7a0e36d0d2841c35abd5659
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Tue Jun 15 15:25:03 2010 -0400

    TypeMetadata lookup function to provide %_BriefDescription back-compat

diff --git a/lib/RT/Transaction_Overlay.pm b/lib/RT/Transaction_Overlay.pm
index 16beaef..ee36ccc 100755
--- a/lib/RT/Transaction_Overlay.pm
+++ b/lib/RT/Transaction_Overlay.pm
@@ -74,7 +74,7 @@ package RT::Transaction;
 use strict;
 no warnings qw(redefine);
 
-use vars qw( %TypeMetadata $PreferredContentType );
+use vars qw( %TypeMetadata %_BriefDescription $PreferredContentType );
 
 use RT::Attachments;
 use RT::Scrips;
@@ -932,7 +932,7 @@ sub BriefDescription {
         return $self->loc("System error");
     }
 
-    if ( my $code = $TypeMetadata{$type}{BriefDescription} ) {
+    if ( my $code = $self->TypeMetadata(Type => $type, Field => 'BriefDescription') ) {
         return $code->($self);
     }
 
@@ -1316,4 +1316,33 @@ sub ACLEquivalenceObjects {
 
 }
 
+=head2 TypeMetadata Type, Field
+
+Takes a param-hash and returns the value of C<Field> for C<Type>.
+
+For back-compat, this will look up C<BriefDescription> in the old
+C<%_BriefDescription> hash. This takes back-compat takes precedence because
+it's certainly possible that extensions override a particular brief
+description.
+
+=cut
+
+sub TypeMetadata {
+    my $self = shift;
+    my %args = (
+        Type => undef,
+        Field => undef,
+        @_,
+    );
+
+    my $type  = $args{Type};
+    my $field = $args{Field};
+
+    if ($field eq 'BriefDescription') {
+        return $_BriefDescription{$type} if $_BriefDescription{$type};
+    }
+
+    return $TypeMetadata{$type}{$field};
+}
+
 1;

-----------------------------------------------------------------------


More information about the Rt-commit mailing list