[Rt-commit] rt branch, 4.4/message-box-include-signature-before-quote, created. rt-4.2.0-34-g01db49c

Alex Vandiver alexmv at bestpractical.com
Thu Nov 21 16:33:37 EST 2013


The branch, 4.4/message-box-include-signature-before-quote has been created
        at  01db49ce5c2e1151596209f61d1f8df842b0c676 (commit)

- Log -----------------------------------------------------------------
commit 152c87c2cd8c4fbd58bf6f1d4bcba634c91fa5a9
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Oct 12 21:41:59 2012 +0800

    added config MessageBoxIncludeSignatureBeforeQuote

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index da50ec3..41a26e8 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -1678,6 +1678,16 @@ C<$MessageBoxIncludeSignature>.
 
 Set($MessageBoxIncludeSignatureOnComment, 1);
 
+=item C<$MessageBoxIncludeSignatureBeforeQuote>
+
+Should your users' signatures (from their Preferences page) be
+included before quoted text
+
+=cut
+
+Set($MessageBoxIncludeSignatureBeforeQuote, 0);
+
+
 =back
 
 
diff --git a/share/html/Elements/MessageBox b/share/html/Elements/MessageBox
index 53af2ca..c8c0d1c 100644
--- a/share/html/Elements/MessageBox
+++ b/share/html/Elements/MessageBox
@@ -48,7 +48,7 @@
 <textarea autocomplete="off" class="messagebox" <% $width_attr %>="<% $Width %>" rows="<% $Height %>" <% $wrap_type |n %> name="<% $Name %>" id="<% $Name %>">\
 % $m->comp('/Articles/Elements/IncludeArticle', %ARGS) if $IncludeArticle;
 % $m->callback( %ARGS, SignatureRef => \$signature );
-<% $Default || '' %><% $message %><% $signature %></textarea>
+<% $Default || '' %><% RT->Config->Get('MessageBoxIncludeSignatureBeforeQuote') ? ( $signature . ( $message =~ /\S/ ? "\n$message" : $message ) ) : ( $message . $signature ) %></textarea>
 % $m->callback( %ARGS, CallbackName => 'AfterTextArea' );
 <%INIT>
 

commit 3f69083ca86016b1a31753e8b348fbe5395e5fc6
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Oct 12 21:52:10 2012 +0800

    allow user to customize MessageBoxIncludeSignatureBeforeQuote in pref

diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index 7ea5433..1984ad9 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -276,6 +276,15 @@ our %META;
             Description => 'Message box height',          #loc
         },
     },
+    MessageBoxIncludeSignatureBeforeQuote => {
+        Section         => 'Ticket composition', #loc
+        Overridable     => 1,
+        SortOrder       => 8.2,
+        Widget          => '/Widgets/Form/Boolean',
+        WidgetArguments => {
+            Description => 'Message box includes signature before quote', #loc
+        },
+    },
     DefaultTimeUnitsToHours => {
         Section         => 'Ticket composition', #loc
         Overridable     => 1,
diff --git a/share/html/Elements/MessageBox b/share/html/Elements/MessageBox
index c8c0d1c..f81df6f 100644
--- a/share/html/Elements/MessageBox
+++ b/share/html/Elements/MessageBox
@@ -48,7 +48,7 @@
 <textarea autocomplete="off" class="messagebox" <% $width_attr %>="<% $Width %>" rows="<% $Height %>" <% $wrap_type |n %> name="<% $Name %>" id="<% $Name %>">\
 % $m->comp('/Articles/Elements/IncludeArticle', %ARGS) if $IncludeArticle;
 % $m->callback( %ARGS, SignatureRef => \$signature );
-<% $Default || '' %><% RT->Config->Get('MessageBoxIncludeSignatureBeforeQuote') ? ( $signature . ( $message =~ /\S/ ? "\n$message" : $message ) ) : ( $message . $signature ) %></textarea>
+<% $Default || '' %><% RT->Config->Get('MessageBoxIncludeSignatureBeforeQuote', $session{CurrentUser}) ? ( $signature . ( $message =~ /\S/ ? "\n$message" : $message ) ) : ( $message . $signature ) %></textarea>
 % $m->callback( %ARGS, CallbackName => 'AfterTextArea' );
 <%INIT>
 

commit 53746f012ea933e9250273b2f98177be05ee9c88
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Oct 24 23:24:36 2012 +0800

    remove the unnecessary "\" because browsers ignore the first newline
    
    see also #21152

diff --git a/share/html/Elements/MessageBox b/share/html/Elements/MessageBox
index f81df6f..3d40789 100644
--- a/share/html/Elements/MessageBox
+++ b/share/html/Elements/MessageBox
@@ -45,7 +45,7 @@
 %# those contributions and any derivatives thereof.
 %#
 %# END BPS TAGGED BLOCK }}}
-<textarea autocomplete="off" class="messagebox" <% $width_attr %>="<% $Width %>" rows="<% $Height %>" <% $wrap_type |n %> name="<% $Name %>" id="<% $Name %>">\
+<textarea autocomplete="off" class="messagebox" <% $width_attr %>="<% $Width %>" rows="<% $Height %>" <% $wrap_type |n %> name="<% $Name %>" id="<% $Name %>">
 % $m->comp('/Articles/Elements/IncludeArticle', %ARGS) if $IncludeArticle;
 % $m->callback( %ARGS, SignatureRef => \$signature );
 <% $Default || '' %><% RT->Config->Get('MessageBoxIncludeSignatureBeforeQuote', $session{CurrentUser}) ? ( $signature . ( $message =~ /\S/ ? "\n$message" : $message ) ) : ( $message . $signature ) %></textarea>

commit e4a418d514cf6dd519a1f68499e15f8123dfefdb
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Oct 24 23:40:57 2012 +0800

    Tweak spaces around signature to provide useful default whitespace
    
    Most signatures don't have trailing newlines, so more than one "\n" is
    necessary between the sig and the quote.  Finally, having a blank line
    (or two) before the "-- \n" means there's an obvious place to click and
    start typing.  With signature-before-quote, this gives (all examples use
    "." for a blank line):
       .
       .
        --
        Foo
        Bar
       .
        On Oct 18, you wrote:
        > ...
    
    This provides a blank line to click on and begin to type, as well as a
    blank line thereafter to separate from the signature.
    
    With the standard signature-after setting, this now gives:
        On Oct 18, you wrote:
        > ...
       .
       .
       .
        --
        Foo
        Bar
    
    ...providing three blank lines in the middle.  This allows the user to
    click on the second one and start typing, but leave whitespace before
    and after their response.  Finally, if there's nothing to quote,
    regardless of the preference:
       .
       .
        --
        Foo
        Bar
    
    ..with a similar click-on-the-first-line use case as described above.

diff --git a/share/html/Elements/MessageBox b/share/html/Elements/MessageBox
index 3d40789..bd98c95 100644
--- a/share/html/Elements/MessageBox
+++ b/share/html/Elements/MessageBox
@@ -48,21 +48,35 @@
 <textarea autocomplete="off" class="messagebox" <% $width_attr %>="<% $Width %>" rows="<% $Height %>" <% $wrap_type |n %> name="<% $Name %>" id="<% $Name %>">
 % $m->comp('/Articles/Elements/IncludeArticle', %ARGS) if $IncludeArticle;
 % $m->callback( %ARGS, SignatureRef => \$signature );
-<% $Default || '' %><% RT->Config->Get('MessageBoxIncludeSignatureBeforeQuote', $session{CurrentUser}) ? ( $signature . ( $message =~ /\S/ ? "\n$message" : $message ) ) : ( $message . $signature ) %></textarea>
+<% $Default || '' %><% $body %></textarea>
 % $m->callback( %ARGS, CallbackName => 'AfterTextArea' );
 <%INIT>
 
 my $message = '';
-
 if ( $QuoteTransaction ) {
     my $transaction = RT::Transaction->new( $session{'CurrentUser'} );
     $transaction->Load( $QuoteTransaction );
     $message = $transaction->Content( Quote => 1 );
+    $message =~ s/\n*$//;
 }
 
-my $signature = '';
-if ( $IncludeSignature and my $text = $session{'CurrentUser'}->UserObj->Signature ) {
-    $signature = "-- \n". $text;
+my $signature = $session{'CurrentUser'}->UserObj->Signature;
+if ( $IncludeSignature and defined $signature and  $signature =~ /\S/ ) {
+    $signature =~ s/\n*$//;
+    $signature = "\n\n-- \n". $signature;
+} else {
+    $signature = "";
+}
+
+my $body = '';
+if ($message =~ /\S/) {
+    if (RT->Config->Get('MessageBoxIncludeSignatureBeforeQuote', $session{CurrentUser})) {
+        $body = $signature . "\n\n" . $message;
+    } else {
+        $body = $message . "\n\n" . $signature;
+    }
+} else {
+    $body = $signature;
 }
 
 # wrap="something" seems to really break IE + richtext

commit 01db49ce5c2e1151596209f61d1f8df842b0c676
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Nov 21 16:15:40 2013 -0500

    Update test; whitespace is allowable, and does not cause an update
    
    This also steps around a bug in WWW::Mechanize -- namely, while real
    browsers ignore a newline that directly follows a <textarea>,
    WWW::Mechanize does not.  As such, it views <textarea>\n</textarea> as
    containing a newline, whereas browsers view it as empty.
    
    In this case, bulk update ignores it unless it has non-whitespace,
    causing the difference to be immaterial.

diff --git a/t/web/search_bulk_update_links.t b/t/web/search_bulk_update_links.t
index d9b477e..c272345 100644
--- a/t/web/search_bulk_update_links.t
+++ b/t/web/search_bulk_update_links.t
@@ -79,11 +79,13 @@ $m->content_lacks( 'DeleteLink--', 'no delete link stuff' );
 $m->form_name('BulkUpdate');
 my @fields = qw/Owner AddRequestor DeleteRequestor AddCc DeleteCc AddAdminCc
 DeleteAdminCc Subject Priority Queue Status Starts_Date Told_Date Due_Date
-UpdateSubject UpdateContent/;
+UpdateSubject/;
 for my $field ( @fields ) {
     is( $m->value($field), '', "default $field is empty" );
 }
 
+like( $m->value('UpdateContent'), qr/^\s*$/, "default UpdateContent is effectively empty" );
+
 # test DependsOn, MemberOf and RefersTo
 $m->submit_form(
     form_name => 'BulkUpdate',

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


More information about the rt-commit mailing list