[Rt-commit] rt branch, 3.8-trunk, updated. rt-3.8.8-55-g072d157

? sunnavy sunnavy at bestpractical.com
Mon May 17 10:32:05 EDT 2010


The branch, 3.8-trunk has been updated
       via  072d1573ecbd7c22bc03a5b5bf4d977b7177fa2d (commit)
      from  6a9eed7921905e1344d12d1ef51c6a414f6ce914 (commit)

Summary of changes:
 lib/RT/Transaction_Overlay.pm |   27 ++++++++++++---------------
 1 files changed, 12 insertions(+), 15 deletions(-)

- Log -----------------------------------------------------------------
commit 072d1573ecbd7c22bc03a5b5bf4d977b7177fa2d
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon May 17 22:32:22 2010 +0800

    back out 6a9eed792190: we need more tests

diff --git a/lib/RT/Transaction_Overlay.pm b/lib/RT/Transaction_Overlay.pm
index a3bcaba..96ccf51 100755
--- a/lib/RT/Transaction_Overlay.pm
+++ b/lib/RT/Transaction_Overlay.pm
@@ -292,23 +292,21 @@ If $args{'Type'} is set to C<text/html>, this will return an HTML
 part of the message, if available.  Otherwise it looks for a text/plain
 part. If $args{'Type'} is missing, it defaults to the value of 
 C<$RT::Transaction::PreferredContentType>, if that's missing too, 
-defaults to the first textual one.
+defaults to 'text/plain'.
 
 =cut
 
 sub Content {
     my $self = shift;
     my %args = (
-        Type => undef,
+        Type  => $PreferredContentType || 'text/plain',
         Quote => 0,
         Wrap  => 70,
         @_
     );
 
     my $content;
-    if ( my $content_obj =
-        $self->ContentObj( $args{Type} ? ( Type => $args{Type} ) : () ) )
-    {
+    if ( my $content_obj = $self->ContentObj( Type => $args{Type} ) ) {
         $content = $content_obj->Content ||'';
 
         if ( lc $content_obj->ContentType eq 'text/html' ) {
@@ -399,7 +397,8 @@ Returns the RT::Attachment object which contains the content for this Transactio
 
 sub ContentObj {
     my $self = shift;
-    my %args = ( Type => $PreferredContentType, @_ );
+    my %args = ( Type => $PreferredContentType || 'text/plain',
+                 @_ );
 
     # If we don't have any content, return undef now.
     # Get the set of toplevel attachments to this transaction.
@@ -414,15 +413,13 @@ sub ContentObj {
     # MIME type ('text/plain' by default).
 
     elsif ( $Attachment->ContentType =~ '^multipart/' ) {
-        if ( $args{Type} ) {
-            my $plain_parts = $Attachment->Children;
-            $plain_parts->ContentType( VALUE => $args{Type} );
-            $plain_parts->LimitNotEmpty;
-
-            # If we actully found a part, return its content
-            if ( my $first = $plain_parts->First ) {
-                return $first;
-            }
+        my $plain_parts = $Attachment->Children;
+        $plain_parts->ContentType( VALUE => $args{Type} );
+        $plain_parts->LimitNotEmpty;
+
+        # If we actully found a part, return its content
+        if ( my $first = $plain_parts->First ) {
+            return $first;
         }
 
         # If that fails, return the first textual part which has some content.

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


More information about the Rt-commit mailing list