[Rt-commit] rt branch, 4.4/wrap-column-count, created. rt-4.4.4-7-g9d9e21588

Blaine Motsinger blaine at bestpractical.com
Mon Mar 18 19:54:43 EDT 2019


The branch, 4.4/wrap-column-count has been created
        at  9d9e215881528ee3a4673bb4017db0f95e6b00df (commit)

- Log -----------------------------------------------------------------
commit fdfb87d9451b87f0831e49f602bd6321c3a9ef33
Author: Blaine Motsinger <blaine at bestpractical.com>
Date:   Fri Mar 15 13:13:32 2019 -0500

    Added configurable option for wrap column count
    
    This change moves the default value for wrap column count from the
    RT::Transaction module to RT_Config.pm.

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 54e5949e7..fa8ef0358 100644
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -2334,6 +2334,15 @@ It defaults to on.  Set this to 0 to disable it.
 
 Set($QuoteFolding, 1);
 
+=item C<$QuoteWrapWidth>
+
+C<$QuoteWrapWidth> controls the number of columns to use when wrapping
+quoted text within transactions.
+
+=cut
+
+Set($QuoteWrapWidth, 70);
+
 =back
 
 
diff --git a/lib/RT/Transaction.pm b/lib/RT/Transaction.pm
index b027ef664..8fc84b46f 100644
--- a/lib/RT/Transaction.pm
+++ b/lib/RT/Transaction.pm
@@ -332,8 +332,9 @@ If this transaction has attached mime objects, returns the body of the first
 textual part (as defined in RT::I18N::IsTextualContentType).  Otherwise,
 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.
+Takes a paramhash.  If the $args{'Quote'} parameter is set, wraps this message
+at $args{'Wrap'}.  $args{'Wrap'} is configurable through the QuoteWrapWidth
+config variable and defaults to 70 characters.
 
 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
@@ -348,7 +349,7 @@ sub Content {
     my %args = (
         Type => $PreferredContentType || '',
         Quote => 0,
-        Wrap  => 70,
+        Wrap => RT->Config->Get('QuoteWrapWidth'),
         @_
     );
 
@@ -442,7 +443,9 @@ sub ApplyQuoteWrap {
         $max = length if length > $max;
     }
 
-    if ( $max > 76 ) {
+    # the addition of 6 here accounts for the extra characters added when quoting
+    # previously quoted text.
+    if ( $max > $args{cols} + 6 ) {
         require Text::Quoted;
         require Text::Wrapper;
 

commit 9d9e215881528ee3a4673bb4017db0f95e6b00df
Author: Blaine Motsinger <blaine at bestpractical.com>
Date:   Mon Mar 18 18:48:45 2019 -0500

    Added configuration verification for wrap column count
    
    The check will ensure the user override is a SCALAR value and
    positive integer.

diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index 431a12ca2..7b797ea78 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -568,6 +568,18 @@ our %META;
             Description => 'Hide unset fields?' # loc
         }
     },
+    QuoteWrapWidth => {
+        Type => 'SCALAR',
+        PostLoadCheck => sub {
+            my $self  = shift;
+            my $value = shift;
+
+            if (!$value or $value !~ m{^\d+$}) {
+                $RT::Logger->debug('The QuoteWrapWidth config option must be a positive integer. Setting to default of 70.');
+                $self->Set( 'QuoteWrapWidth', 70 );
+            }
+        },
+    },
 
     # User overridable locale options
     DateTimeFormat => {

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


More information about the rt-commit mailing list