[Rt-commit] rt branch 5.0/show-signature-when-quoting created. rt-5.0.1-611-g6271ca877e
BPS Git Server
git at git.bestpractical.com
Fri Sep 3 14:36:15 UTC 2021
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".
The branch, 5.0/show-signature-when-quoting has been created
at 6271ca877e5b347fcf06d9a446d976631cd6bb3f (commit)
- Log -----------------------------------------------------------------
commit 6271ca877e5b347fcf06d9a446d976631cd6bb3f
Author: sunnavy <sunnavy at bestpractical.com>
Date: Fri Sep 3 21:38:24 2021 +0800
Respect MessageBoxIncludeSignature config on ticket update pages
diff --git a/share/html/SelfService/Update.html b/share/html/SelfService/Update.html
index bb88ca79a0..540881b8f9 100644
--- a/share/html/SelfService/Update.html
+++ b/share/html/SelfService/Update.html
@@ -97,7 +97,7 @@
% }
% $ARGS{'QuoteTransaction'} = $temp;
% } else {
-% my $IncludeSignature = 1;
+% my $IncludeSignature = RT->Config->Get('MessageBoxIncludeSignature');
<& /Elements/MessageBox, Name=>"UpdateContent", IncludeSignature => $IncludeSignature, %ARGS &>
% }
</div>
diff --git a/share/html/Ticket/Update.html b/share/html/Ticket/Update.html
index 26ea8550b6..adc82d267d 100644
--- a/share/html/Ticket/Update.html
+++ b/share/html/Ticket/Update.html
@@ -178,7 +178,7 @@
<div class="form-group">
<div class="messagebox-container action-<% $type %>">
% $m->callback( %ARGS, CallbackName => 'BeforeMessageBox' );
-% my $IncludeSignature = 1;
+% my $IncludeSignature = RT->Config->Get('MessageBoxIncludeSignature');
% $IncludeSignature = 0 if $Action ne 'Respond' && !RT->Config->Get('MessageBoxIncludeSignatureOnComment');
% if (exists $ARGS{UpdateContent}) {
% # preserve QuoteTransaction so we can use it to set up sane references/in/reply to
commit af52372e04c8da5bdcdbcdb88d38625ebe2bbf28
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Wed Sep 1 15:42:15 2021 -0400
Align selected quote content with transaction quote formatting
Update processing for selected quote text to align it with
quote handling when replying/commenting on a transaction,
specifically:
* Move quote formatting from JS to using the same method
used for transaction quoting
* Display the quote header if we have a transaction to
reference
diff --git a/lib/RT/Transaction.pm b/lib/RT/Transaction.pm
index e6a5746ce0..0284f5428b 100644
--- a/lib/RT/Transaction.pm
+++ b/lib/RT/Transaction.pm
@@ -399,23 +399,50 @@ sub Content {
}
if ( $args{'Quote'} ) {
- if ($args{Type} eq 'text/html') {
- $content = '<div class="gmail_quote">'
- . $self->QuoteHeader
- . '<br /><blockquote class="gmail_quote" type="cite">'
- . $content
- . '</blockquote></div>';
- } else {
- $content = $self->ApplyQuoteWrap(content => $content,
- cols => $args{'Wrap'} );
-
- $content = $self->QuoteHeader . "\n$content";
- }
+ $content = $self->ApplyQuoteFormat( Content => $content,
+ Type => $args{'Type'},
+ QuoteHeader => 1,
+ Wrap => $args{'Wrap'} );
}
return ($content);
}
+=head2 ApplyQuoteFormat
+
+Apply additional quote formatting like quote characters and the
+quote header.
+
+=cut
+
+sub ApplyQuoteFormat {
+ my $self = shift;
+ my %args = (
+ Type => '',
+ Wrap => RT->Config->Get('QuoteWrapWidth'),
+ @_
+ );
+
+ my $content = $args{'Content'};
+ my $quote_header = '';
+
+ if ( $args{'QuoteHeader'} ) {
+ $quote_header = $self->QuoteHeader;
+ }
+
+ if ( $args{'Type'} eq 'text/html') {
+ $content = '<div class="gmail_quote">'
+ . $quote_header
+ . '<br /><blockquote class="gmail_quote" type="cite">'
+ . $content
+ . '</blockquote></div>';
+ } else {
+ $content = $self->ApplyQuoteWrap(content => $content,
+ cols => $args{'Wrap'} );
+ $content = $quote_header . "\n$content";
+ }
+}
+
=head2 QuoteHeader
Returns text prepended to content when transaction is quoted
diff --git a/share/html/SelfService/Update.html b/share/html/SelfService/Update.html
index ddbd430166..bb88ca79a0 100644
--- a/share/html/SelfService/Update.html
+++ b/share/html/SelfService/Update.html
@@ -88,7 +88,7 @@
% my $temp = $ARGS{'QuoteTransaction'};
% delete $ARGS{'QuoteTransaction'};
% if ( $ARGS{'ContentFromQuote'} ) { # Handle quoted content
- <& /Elements/MessageBox, Name=>"UpdateContent", Message=>$ARGS{'UpdateContent'}, IncludeSignature => 1, %ARGS&>
+ <& /Elements/MessageBox, Name=>"UpdateContent", Message=>$quoted_message, IncludeSignature => 1, %ARGS&>
% }
% else {
% # Suppress signature here to avoid adding it multiple times on Update page edits, when
@@ -133,6 +133,27 @@ Abort( loc("No permission to view update ticket") )
ProcessAttachments(ARGSRef => \%ARGS);
+# Process quoted text passed in from ticket display
+my $quoted_message;
+if ( $ARGS{'ContentFromQuote'} ) {
+ my $content_type = RT->Config->Get('MessageBoxRichText', $session{'CurrentUser'}) ? 'text/html' : 'text/plain';
+
+ # Using the transaction object only for the quote methods
+ my $transaction = RT::Transaction->new( $session{'CurrentUser'} );
+ if ( $ARGS{'QuoteTransaction'} ) {
+ $transaction->Load( $ARGS{'QuoteTransaction'} );
+ $quoted_message = $transaction->ApplyQuoteFormat( Content => $ARGS{'UpdateContent'},
+ Type => $content_type,
+ QuoteHeader => 1 );
+ }
+ else {
+ $transaction = $Ticket->Transactions->First;
+ $quoted_message = $transaction->ApplyQuoteFormat( Content => $ARGS{'UpdateContent'},
+ Type => $content_type,
+ QuoteHeader => 0 );
+ }
+}
+
if ( exists $ARGS{SubmitTicket} ) {
$m->callback(CallbackName => 'BeforeDisplay', Ticket => \$Ticket, ARGSRef => \%ARGS);
return $m->comp('Display.html', TicketObj => $Ticket, %ARGS);
diff --git a/share/html/Ticket/Update.html b/share/html/Ticket/Update.html
index 318cc3f3e5..26ea8550b6 100644
--- a/share/html/Ticket/Update.html
+++ b/share/html/Ticket/Update.html
@@ -185,7 +185,7 @@
% my $temp = $ARGS{'QuoteTransaction'};
% delete $ARGS{'QuoteTransaction'};
% if ( $ARGS{'ContentFromQuote'} ) { # Handle quoted content
- <& /Elements/MessageBox, Name=>"UpdateContent", Message=>$ARGS{'UpdateContent'}, IncludeSignature => $IncludeSignature, %ARGS&>
+ <& /Elements/MessageBox, Name=>"UpdateContent", Message=>$quoted_message, IncludeSignature => $IncludeSignature, %ARGS&>
% }
% else {
% # Suppress signature here to avoid adding it multiple times on Update page edits, when
@@ -444,6 +444,27 @@ if ( $ARGS{'SubmitTicket'} ) {
}
}
+# Process quoted text passed in from ticket display
+my $quoted_message;
+if ( $ARGS{'ContentFromQuote'} ) {
+ my $content_type = RT->Config->Get('MessageBoxRichText', $session{'CurrentUser'}) ? 'text/html' : 'text/plain';
+
+ # Using the transaction object only for the quote methods
+ my $transaction = RT::Transaction->new( $session{'CurrentUser'} );
+ if ( $ARGS{'QuoteTransaction'} ) {
+ $transaction->Load( $ARGS{'QuoteTransaction'} );
+ $quoted_message = $transaction->ApplyQuoteFormat( Content => $ARGS{'UpdateContent'},
+ Type => $content_type,
+ QuoteHeader => 1 );
+ }
+ else {
+ $transaction = $TicketObj->Transactions->First;
+ $quoted_message = $transaction->ApplyQuoteFormat( Content => $ARGS{'UpdateContent'},
+ Type => $content_type,
+ QuoteHeader => 0 );
+ }
+}
+
# $skip_update is provided below by reference to allow a final check to stop
# the update and print a message for the user to fix something.
my $skip_update = 0;
diff --git a/share/static/js/quoteselection.js b/share/static/js/quoteselection.js
index cf216347ea..16e1097ad9 100644
--- a/share/static/js/quoteselection.js
+++ b/share/static/js/quoteselection.js
@@ -16,15 +16,6 @@ jQuery(function() {
if (typeof(selection) !== "string" || selection.length < 3)
return;
- // TODO: wrap long lines before quoting
- selection = selection.replace(/^/gm, "> ");
- if ( RT.Config.MessageBoxRichText ) {
- selection = selection.replace(/\r?\n/g, "<br>");
- selection = selection.concat("<br><br>");
- }
- else {
- selection = selection.concat("\n\n");
- }
selection = encodeURIComponent(selection);
if ( !link.prop('data-href') ) {
commit e88ade4726b2a60937c200bb8114e9abcfcc34c9
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Wed Sep 1 13:10:19 2021 -0400
Show user signature when quoting content from ticket display
RT-Extension-QuoteSelection noted in its "CAVEATS" that it
did not include user signatures when quoting and this behavior
was retained when it was added to core. This was likely because
it used the existing UpdateContent ARG to populate content, and
that explitily excludes signatures to avoid re-adding them when
changes are made on the update page.
Add a new arg to detect content added from quoting so we can
show signatures, making this consistent with the default
update behavior.
Also move the quoted content to a new Message ARG so it gets
positioned properly if SignatureAboveQuote is enabled.
diff --git a/share/html/Elements/MessageBox b/share/html/Elements/MessageBox
index 1c199816a6..7c59bbca93 100644
--- a/share/html/Elements/MessageBox
+++ b/share/html/Elements/MessageBox
@@ -66,7 +66,7 @@
% }
<%INIT>
-my $message = '';
+my $message = $Message // '';
if ( $QuoteTransaction ) {
my $transaction = RT::Transaction->new( $session{'CurrentUser'} );
@@ -126,6 +126,7 @@ if ($Width) {
</%INIT>
<%ARGS>
$QuoteTransaction => undef
+$Message => undef # Initial default quoted message
$Name => 'Content'
$Default => ''
$Width => RT->Config->Get('MessageBoxWidth', $session{'CurrentUser'} )
diff --git a/share/html/SelfService/Update.html b/share/html/SelfService/Update.html
index 50e1bdb5cd..ddbd430166 100644
--- a/share/html/SelfService/Update.html
+++ b/share/html/SelfService/Update.html
@@ -87,7 +87,14 @@
% # preserve QuoteTransaction so we can use it to set up sane references/in/reply to
% my $temp = $ARGS{'QuoteTransaction'};
% delete $ARGS{'QuoteTransaction'};
-<& /Elements/MessageBox, Name=>"UpdateContent", Default=>$ARGS{UpdateContent}, IncludeSignature => 0, %ARGS &>
+% if ( $ARGS{'ContentFromQuote'} ) { # Handle quoted content
+ <& /Elements/MessageBox, Name=>"UpdateContent", Message=>$ARGS{'UpdateContent'}, IncludeSignature => 1, %ARGS&>
+% }
+% else {
+% # Suppress signature here to avoid adding it multiple times on Update page edits, when
+% # UpdateContent is re-submitted, like adding attachments with the form button.
+ <& /Elements/MessageBox, Name=>"UpdateContent", Default=>$ARGS{'UpdateContent'}, IncludeSignature => 0, %ARGS&>
+% }
% $ARGS{'QuoteTransaction'} = $temp;
% } else {
% my $IncludeSignature = 1;
diff --git a/share/html/Ticket/Update.html b/share/html/Ticket/Update.html
index 21bb8ed522..318cc3f3e5 100644
--- a/share/html/Ticket/Update.html
+++ b/share/html/Ticket/Update.html
@@ -178,15 +178,22 @@
<div class="form-group">
<div class="messagebox-container action-<% $type %>">
% $m->callback( %ARGS, CallbackName => 'BeforeMessageBox' );
+% my $IncludeSignature = 1;
+% $IncludeSignature = 0 if $Action ne 'Respond' && !RT->Config->Get('MessageBoxIncludeSignatureOnComment');
% if (exists $ARGS{UpdateContent}) {
% # preserve QuoteTransaction so we can use it to set up sane references/in/reply to
% my $temp = $ARGS{'QuoteTransaction'};
% delete $ARGS{'QuoteTransaction'};
- <& /Elements/MessageBox, Name=>"UpdateContent", Default=>$ARGS{UpdateContent}, IncludeSignature => 0, %ARGS&>
+% if ( $ARGS{'ContentFromQuote'} ) { # Handle quoted content
+ <& /Elements/MessageBox, Name=>"UpdateContent", Message=>$ARGS{'UpdateContent'}, IncludeSignature => $IncludeSignature, %ARGS&>
+% }
+% else {
+% # Suppress signature here to avoid adding it multiple times on Update page edits, when
+% # UpdateContent is re-submitted, like adding attachments with the form button.
+ <& /Elements/MessageBox, Name=>"UpdateContent", Default=>$ARGS{'UpdateContent'}, IncludeSignature => 0, %ARGS&>
+% }
% $ARGS{'QuoteTransaction'} = $temp;
% } else {
-% my $IncludeSignature = 1;
-% $IncludeSignature = 0 if $Action ne 'Respond' && !RT->Config->Get('MessageBoxIncludeSignatureOnComment');
<& /Elements/MessageBox, Name=>"UpdateContent", IncludeSignature => $IncludeSignature, %ARGS &>
% }
% $m->callback( %ARGS, CallbackName => 'AfterMessageBox' );
diff --git a/share/static/js/quoteselection.js b/share/static/js/quoteselection.js
index ec246790ee..cf216347ea 100644
--- a/share/static/js/quoteselection.js
+++ b/share/static/js/quoteselection.js
@@ -30,7 +30,7 @@ jQuery(function() {
if ( !link.prop('data-href') ) {
link.prop('data-href', link.attr('href'));
}
- link.attr("href", link.prop("data-href").concat("&UpdateContent=" + selection));
+ link.attr("href", link.prop("data-href").concat("&ContentFromQuote=1&UpdateContent=" + selection));
};
var apply_quote = function() {
-----------------------------------------------------------------------
hooks/post-receive
--
rt
More information about the rt-commit
mailing list