[Rt-commit] rt branch, 4.0/disable-att-quote-folding, created. rt-4.0.0-282-g285b1a0

? sunnavy sunnavy at bestpractical.com
Fri May 13 04:23:22 EDT 2011


The branch, 4.0/disable-att-quote-folding has been created
        at  285b1a082b36db8b963ae960739c0132e661d4a0 (commit)

- Log -----------------------------------------------------------------
commit d2762b27d8723bd51791cfed7be8a0e3e8163130
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri May 13 15:44:24 2011 +0800

    disable attachments' quote folding
    
    think about .diff files for example

diff --git a/share/html/Ticket/Elements/ShowTransactionAttachments b/share/html/Ticket/Elements/ShowTransactionAttachments
index b503346..ecbbc12 100644
--- a/share/html/Ticket/Elements/ShowTransactionAttachments
+++ b/share/html/Ticket/Elements/ShowTransactionAttachments
@@ -144,6 +144,8 @@ my $render_attachment = sub {
 
     # if it has a content-disposition: attachment, don't show inline
     my $disposition = $message->GetHeader('Content-Disposition');
+    my $has_name = $disposition && $disposition =~ /filename=.+/ ? 1 : 0;
+
     if ( $disposition && $disposition =~ /attachment/i && $disposition !~ /^\s*inline/ ) {
         $disposition = 'attachment';
     } else {
@@ -213,13 +215,13 @@ my $render_attachment = sub {
                 );
 
                 require HTML::Quoted;
-                $content = HTML::Quoted->extract( $content );
+                $content = HTML::Quoted->extract( $content ) unless $has_name;
 
                 $m->comp(
                     'ShowMessageStanza',
                     Message     => $content,
                     Transaction => $Transaction,
-                    ContentType => 'text/html'
+                    ContentType => 'text/html',
                 );
             }
 
@@ -231,14 +233,16 @@ my $render_attachment = sub {
             # if it's a text/plain show the body
             elsif ( $message->ContentType =~ m{^(text|message)}i ) {
 
-                eval { require Text::Quoted;  $content = Text::Quoted::extract($content); };
-                if ($@) { $RT::Logger->warning( "Text::Quoted failed: $@" ) }
+                unless ( $has_name ) {
+                    eval { require Text::Quoted;  $content = Text::Quoted::extract($content); };
+                    if ($@) { $RT::Logger->warning( "Text::Quoted failed: $@" ) }
+                }
 
                 $m->comp(
                     'ShowMessageStanza',
                     Message     => $content,
                     Transaction => $Transaction,
-                    ContentType => 'text/plain'
+                    ContentType => 'text/plain',
                 );
             }
         }

commit 285b1a082b36db8b963ae960739c0132e661d4a0
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri May 13 15:59:18 2011 +0800

    we don't seem use _rt_dict anywhere

diff --git a/share/html/Ticket/Elements/ShowHistory b/share/html/Ticket/Elements/ShowHistory
index 10ccf1f..a4b1fdc 100755
--- a/share/html/Ticket/Elements/ShowHistory
+++ b/share/html/Ticket/Elements/ShowHistory
@@ -77,13 +77,6 @@ if ($ShowDisplayModes or $ShowTitle) {
     }
 </%perl>
 <div class="history">
-<script type="text/javascript">
-var _rt_dict = {};
-_rt_dict = { 'hide quoted text': '<% loc('hide quoted text') %>',
-             'show quoted text': '<% loc('show quoted text') %>'
-           };
-</script>
-
 <& /Widgets/TitleBoxStart, title => $title, titleright_raw => $titleright &>
 % }
 <div id="ticket-history">

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


More information about the Rt-commit mailing list