[Rt-commit] r16186 - in rt/3.8/trunk: .

falcone at bestpractical.com falcone at bestpractical.com
Wed Oct 1 17:30:29 EDT 2008


Author: falcone
Date: Wed Oct  1 17:30:28 2008
New Revision: 16186

Modified:
   rt/3.8/trunk/   (props changed)
   rt/3.8/trunk/lib/RT/Template_Overlay.pm

Log:
 r40346 at ketch:  falcone | 2008-10-01 17:29:21 -0400
 * don't reparse the template, just turn the HTML template 
   into plaintext.
 * Don't declare the original mime object as multipart until
   we've dup'ed it or crazy things happen to the body of the
   mime pieces and we end up with very nested mails


Modified: rt/3.8/trunk/lib/RT/Template_Overlay.pm
==============================================================================
--- rt/3.8/trunk/lib/RT/Template_Overlay.pm	(original)
+++ rt/3.8/trunk/lib/RT/Template_Overlay.pm	Wed Oct  1 17:30:28 2008
@@ -430,22 +430,14 @@
     my $self = shift;
     my $orig_entity = $self->MIMEObj;
 
-    local $RT::Transaction::PreferredContentType = 'text/plain';
-
-    my ($rv, $msg) = $self->_Parse(@_);
-    if (!$rv) {
-        $self->{MIMEObj} = $orig_entity;
-        return;
-    }
+    my $new_entity = $orig_entity->dup; # this will fail badly if we go away from InCore parsing
+    $new_entity->head->mime_attr( "Content-Type" => 'text/plain' );
+    $new_entity->head->mime_attr( "Content-Type.charset" => 'utf-8' );
 
     $orig_entity->head->mime_attr( "Content-Type" => 'text/html' );
     $orig_entity->head->mime_attr( "Content-Type.charset" => 'utf-8' );
     $orig_entity->make_multipart('alternative', Force => 1);
 
-    my $new_entity = $self->{MIMEObj};
-    $new_entity->head->mime_attr( "Content-Type" => 'text/plain' );
-    $new_entity->head->mime_attr( "Content-Type.charset" => 'utf-8' );
-
     require HTML::FormatText;
     require HTML::TreeBuilder;
     $new_entity->bodyhandle(MIME::Body::InCore->new(\(scalar(HTML::FormatText->new(
@@ -458,7 +450,8 @@
     $orig_entity->add_part($new_entity, 0); # plain comes before html
     $self->{MIMEObj} = $orig_entity;
 
-    return ($rv, $msg);
+    return;
+
 }
 
 =head2 CurrentUserHasQueueRight


More information about the Rt-commit mailing list