[Rt-commit] rt branch, 4.2/hide-no-content-extract-article, created. rt-4.2.11-42-gc80e462

Dustin Graves dustin at bestpractical.com
Wed Aug 5 17:56:05 EDT 2015


The branch, 4.2/hide-no-content-extract-article has been created
        at  c80e462eee027abdfe91835a6acaa65b001d608c (commit)

- Log -----------------------------------------------------------------
commit c80e462eee027abdfe91835a6acaa65b001d608c
Author: Dustin Graves <dustin at bestpractical.com>
Date:   Wed Aug 5 21:54:07 2015 +0000

    hide transactions with 'Transaction has no content' from extract article
    
    added method HasContent to RT::Transaction to be used to hide these
    transactions
    
    Fixes: I#31027

diff --git a/lib/RT/Transaction.pm b/lib/RT/Transaction.pm
index d909171..ec759d3 100644
--- a/lib/RT/Transaction.pm
+++ b/lib/RT/Transaction.pm
@@ -310,11 +310,25 @@ sub Message {
 
 
 
+=head2 HasContent
+
+Returns whether this transaction has attached mime objects.
+
+=cut
+
+sub HasContent {
+    my $self = shift;
+    my $type = $PreferredContentType || '';
+    return !!$self->ContentObj( $type ? ( Type => $type) : () );
+}
+
+
+
 =head2 Content PARAMHASH
 
 If this transaction has attached mime objects, returns the body of the first
 textual part (as defined in RT::I18N::IsTextualContentType).  Otherwise,
-returns undef.
+returns the message "This transaction appears to have no content".
 
 Takes a paramhash.  If the $args{'Quote'} parameter is set, wraps this message 
 at $args{'Wrap'}.  $args{'Wrap'} defaults to 70.
@@ -337,8 +351,8 @@ sub Content {
     );
 
     my $content;
-    if ( my $content_obj =
-        $self->ContentObj( $args{Type} ? ( Type => $args{Type} ) : () ) )
+    if ( my $content_obj = 
+        $self->ContentObj( $args{Type} ? ( Type => $args{Type}) : () ) )
     {
         $content = $content_obj->Content ||'';
 
diff --git a/share/html/Articles/Article/ExtractFromTicket.html b/share/html/Articles/Article/ExtractFromTicket.html
index c007585..99c4a4f 100644
--- a/share/html/Articles/Article/ExtractFromTicket.html
+++ b/share/html/Articles/Article/ExtractFromTicket.html
@@ -64,7 +64,7 @@
 </tr>
 % my $i;
 % while ( my $trans = $transactions->Next ) { 
-% next unless $trans->Content;
+% next unless $trans->HasContent && $trans->Content;
 <tr class="<% ($i++)%2 ? 'oddline' : 'evenline'%>" >                                
 <td valign="top">
 <select name="Transaction-<%$trans->Id%>">

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


More information about the rt-commit mailing list