[Rt-commit] rt branch, history-filter, updated. rt-3.8.8-93-g72367f6

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


The branch, history-filter has been updated
       via  72367f65472f6bc41b1464b7eb5e26969e5516d5 (commit)
      from  b15e86e44b141be8114ff51a405dc302e915dd92 (commit)

Summary of changes:
 lib/RT/Transaction_Overlay.pm |   45 +++++++++++++++++++++-------------------
 1 files changed, 24 insertions(+), 21 deletions(-)

- Log -----------------------------------------------------------------
commit 72367f65472f6bc41b1464b7eb5e26969e5516d5
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Tue Jun 15 17:20:09 2010 -0400

    Factor Status into %TypeMetadata
    
        The weird logic of "if (/Status/) { if (Field eq 'Status') { ..." was
        from 2000 and had useless duplication of the fallback code

diff --git a/lib/RT/Transaction_Overlay.pm b/lib/RT/Transaction_Overlay.pm
index 38c9eef..24bc6ce 100755
--- a/lib/RT/Transaction_Overlay.pm
+++ b/lib/RT/Transaction_Overlay.pm
@@ -377,6 +377,25 @@ use HTML::TreeBuilder;
             return ( $self->loc( "[_1] disabled", $args{obj_type} ) );
         },
     },
+    Status => {
+        BriefDescription => sub {
+            my $self = shift;
+            my %args = @_;
+
+            if ( $self->NewValue eq 'deleted' ) {
+                return ( $self->loc( "[_1] deleted", $args{obj_type} ) );
+            }
+            else {
+                return (
+                    $self->loc(
+                        "Status changed from [_1] to [_2]",
+                        "'" . $self->loc( $self->OldValue ) . "'",
+                        "'" . $self->loc( $self->NewValue ) . "'"
+                    )
+                );
+            }
+        },
+    },
 );
 # }}}
 
@@ -916,28 +935,12 @@ sub BriefDescription {
         return $self->loc("No transaction type specified");
     }
 
-    my $obj_type = $self->FriendlyObjectType;
-
-    if ( $type =~ /Status/ ) {
-        if ( $self->Field eq 'Status' ) {
-            if ( $self->NewValue eq 'deleted' ) {
-                return ( $self->loc( "[_1] deleted", $obj_type ) );
-            }
-            else {
-                return (
-                    $self->loc(
-                        "Status changed from [_1] to [_2]",
-                        "'" . $self->loc( $self->OldValue ) . "'",
-                        "'" . $self->loc( $self->NewValue ) . "'"
-                    )
-                );
-
-            }
-        }
-    }
-
     if ( my $code = $self->TypeMetadata(Type => $type, Field => 'BriefDescription') ) {
-        my $description = $code->($self, obj_type => $obj_type);
+        my %args = (
+            obj_type => $self->FriendlyObjectType,
+        );
+
+        my $description = $code->($self, %args);
         return $description if defined $description;
     }
 

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


More information about the Rt-commit mailing list