[Rt-commit] rt branch, 4.2/forward-with-message, updated. rt-4.0.6-253-gfb3f005

Alex Vandiver alexmv at bestpractical.com
Mon Aug 6 21:36:58 EDT 2012


The branch, 4.2/forward-with-message has been updated
       via  fb3f005574382822cf57dbccc469562423d55688 (commit)
       via  007114c630499239e5e455191e24918d53d7ddd8 (commit)
      from  ab8edd262c5741ea25f1ff521d6721d3f78fabd3 (commit)

Summary of changes:
 etc/initialdata                |  7 ++-----
 lib/RT/Action/SendForward.pm   | 17 +++--------------
 lib/RT/Ticket.pm               |  8 +++++---
 share/html/Ticket/Forward.html |  6 ++----
 4 files changed, 12 insertions(+), 26 deletions(-)

- Log -----------------------------------------------------------------
commit 007114c630499239e5e455191e24918d53d7ddd8
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Aug 6 21:32:39 2012 -0400

    Only add the default "This is a forward..." if no content is supplied

diff --git a/etc/initialdata b/etc/initialdata
index bcd4117..61021b2 100755
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -405,9 +405,8 @@ The ticket has been approved, you may now start to act on it.
        Name        => "Forward",    # loc
        Description => "Forwarded message", # loc
        Content => q{
-This is a forward of transaction #{$Transaction->id} of ticket #{ $Ticket->id }
 
-{ $ForwardTransaction->Content }
+{ $ForwardTransaction->Content =~ /\S/ ? $ForwardTransaction->Content : "This is a forward of transaction #".$Transaction->id." of ticket #". $Ticket->id }
 }
     },
     {  Queue       => 0,
@@ -415,9 +414,7 @@ This is a forward of transaction #{$Transaction->id} of ticket #{ $Ticket->id }
        Description => "Forwarded ticket message", # loc
        Content => q{
 
-This is a forward of ticket #{ $Ticket->id }
-
-{ $ForwardTransaction->Content }
+{ $ForwardTransaction->Content =~ /\S/ ? $ForwardTransaction->Content : "This is a forward of ticket #". $Ticket->id }
 }
     },
     {  Queue       => 0,

commit fb3f005574382822cf57dbccc469562423d55688
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Aug 6 21:36:38 2012 -0400

    Allow forwarding to set the subject

diff --git a/lib/RT/Action/SendForward.pm b/lib/RT/Action/SendForward.pm
index f524095..7776a5c 100644
--- a/lib/RT/Action/SendForward.pm
+++ b/lib/RT/Action/SendForward.pm
@@ -107,18 +107,6 @@ sub Prepare {
 
     $mime->add_part($entity);
 
-    unless ( $mime->head->get('Subject') ) {
-        my $subject = '';
-        $subject = $self->ForwardedTransactionObj->Subject
-          if $self->ForwardedTransactionObj;
-        $subject ||= $self->TicketObj->Subject;
-        unless ( RT->Config->Get('ForwardFromUser') ) {
-            $subject =
-              RT::Interface::Email::AddSubjectTag( $subject, $self->TicketObj );
-        }
-        $mime->head->set( Subject => $self->MIMEEncodeString("Fwd: $subject") );
-    }
-
     my $txn_attachment = $self->TransactionObj->Attachments->First;
     for my $header (qw/From To Cc Bcc/) {
         if ( $txn_attachment->GetHeader( $header ) ) {
@@ -134,8 +122,9 @@ sub Prepare {
 }
 
 sub SetSubjectToken {
-
-    # we already take care of this in Prepare.
+    my $self = shift;
+    return if RT->Config->Get('ForwardFromUser');
+    $self->SUPER::SetSubjectToken(@_);
 }
 
 sub ForwardedTransactionObj {
diff --git a/lib/RT/Ticket.pm b/lib/RT/Ticket.pm
index 2d630c9..6b860c6 100644
--- a/lib/RT/Ticket.pm
+++ b/lib/RT/Ticket.pm
@@ -3759,6 +3759,7 @@ sub Forward {
     my $self = shift;
     my %args = (
         Transaction    => undef,
+        Subject        => '',
         To             => '',
         Cc             => '',
         Bcc            => '',
@@ -3774,13 +3775,14 @@ sub Forward {
     }
 
     my $mime = MIME::Entity->build(
-        Type => $args{'ContentType'},
-        Data => $args{Content},
+        Subject => $args{Subject},
+        Type    => $args{ContentType},
+        Data    => $args{Content},
     );
 
     $mime->head->set(
         $_ => RT::Interface::Email::EncodeToMIME( String => $args{$_} ) )
-      for grep defined $args{$_}, qw(To Cc Bcc);
+      for grep defined $args{$_}, qw(Subject To Cc Bcc);
     $mime->head->set(
         From => RT::Interface::Email::EncodeToMIME(
             String => RT::Interface::Email::GetForwardFrom(
diff --git a/share/html/Ticket/Forward.html b/share/html/Ticket/Forward.html
index 4826272..eb38a24 100644
--- a/share/html/Ticket/Forward.html
+++ b/share/html/Ticket/Forward.html
@@ -61,7 +61,7 @@
 <td><% $from %></td></tr>
 
 <tr><td align="right"><&|/l&>Subject</&>:</td>
-<td><% $subject %></td></tr>
+<td><input name="Subject" size="60" value="<% $ARGS{'Subject'} || $subject %>" /></td></tr>
 
 <tr><td align="right"><&|/l&>To</&>:</td>
 <td><input name="To" size="60" value="<% $ARGS{'To'} || '' %>" /></td></tr>
@@ -125,9 +125,7 @@ my $Title = $txn
 my $from = RT::Interface::Email::GetForwardFrom(
     $txn ? ( Transaction => $txn ) : ( Ticket => $TicketObj ) );
 
-my $subject = $TicketObj->Subject;
-$subject = RT::Interface::Email::AddSubjectTag( $subject, $TicketObj )
-    unless RT->Config->Get('ForwardFromUser');
+my $subject = "Fwd: ".($txn || $TicketObj)->Subject;
 
 my $attachments = RT::Interface::Email::GetForwardAttachments(
     Ticket => $TicketObj,

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


More information about the Rt-commit mailing list