[Rt-commit] rt branch, 4.2/forward-with-message, repushed

? sunnavy sunnavy at bestpractical.com
Sat Aug 24 02:08:07 EDT 2013


The branch 4.2/forward-with-message was deleted and repushed:
       was b109f0bb9540bcfdffe54672c7f24e02b67eab11
       now ec4317f238cff012700b9e31eff170210575a30f

1:  62a4a2b = 1:  ff036e8 definition of $result is too far away, 1 is more clear
2:  ab8edd2 ! 2:  a1a4f73 support customized forward message and use scrip to send forwarded message
    @@ -5,9 +5,6 @@
         now we record the forward transaction with customized message and use a scrip
         bound to it to actually send the message.
         (SendForward action is newly added for it)
    -    
    -    As we use SendEmail action, invalid recipients will be stripped, so I removed
    -    "rt-test" recipient in test.
     
     diff --git a/etc/initialdata b/etc/initialdata
     --- a/etc/initialdata
    @@ -260,6 +257,9 @@
     -    my $txn = shift;
     -    my %args = ( To => '', Cc => '', Bcc => '', @_ );
     -
    +-    $args{$_} = join ", ", map { $_->format } RT::EmailParser->ParseEmailAddress($args{$_} || '')
    +-        for qw(To Cc Bcc);
    +-
     -    my $entity = $txn->ContentAsMIME;
     -
     -    my ( $ret, $msg ) = SendForward( %args, Entity => $entity, Transaction => $txn );
    @@ -287,6 +287,9 @@
     -    my $ticket = shift;
     -    my %args = ( To => '', Cc => '', Bcc => '', @_ );
     -
    +-    $args{$_} = join ", ", map { $_->format } RT::EmailParser->ParseEmailAddress($args{$_} || '')
    +-        for qw(To Cc Bcc);
    +-
     -    my $txns = $ticket->Transactions;
     -    $txns->Limit(
     -        FIELD    => 'Type',
    @@ -471,7 +474,7 @@
     +++ b/lib/RT/Ticket.pm
     @@
      
    - }
    + sub ModifyLinkRight { "ModifyTicket" }
      
     +=head2 Forward Transaction => undef, To => '', Cc => '', Bcc => ''
     +
    @@ -497,6 +500,8 @@
     +        return ( 0, $self->loc("Permission Denied") );
     +    }
     +
    ++    $args{$_} = join ", ", map { $_->format } RT::EmailParser->ParseEmailAddress( $args{$_} || '' ) for qw(To Cc Bcc);
    ++
     +    my $mime = MIME::Entity->build(
     +        Type => $args{'ContentType'},
     +        Data => $args{Content},
    @@ -529,6 +534,7 @@
     +            Type  => 'Forward Ticket',
     +            Field => $self->id,
     +        ),
    ++        Data  => join( ', ', grep { length } $args{To}, $args{Cc}, $args{Bcc} ),
     +        MIMEObj => $mime,
     +        CommitScrips => $args{'CommitScrips'},
     +    );
    @@ -542,27 +548,10 @@
     +    }
     +    return ( $ret, $self->loc('Message recorded') );
     +}
    - 
    ++
      1;
      
    -
    -diff --git a/lib/RT/Transaction.pm b/lib/RT/Transaction.pm
    ---- a/lib/RT/Transaction.pm
    -+++ b/lib/RT/Transaction.pm
    -@@
    -         return $self->loc("System error");
    -     }
    -     elsif ( $type =~ /Forward Transaction/ ) {
    --        return $self->loc( "Forwarded Transaction #[_1] to [_2]",
    --            $self->Field, $self->Data );
    -+        return $self->loc( "Forwarded Transaction #[_1]", $self->Field );
    -     }
    -     elsif ( $type =~ /Forward Ticket/ ) {
    --        return $self->loc( "Forwarded Ticket to [_1]", $self->Data );
    -+        return $self->loc( "Forwarded Ticket" );
    -     }
    - 
    -     if ( my $code = $_BriefDescriptions{$type} ) {
    + =head1 AUTHOR
     
     diff --git a/share/html/Ticket/Forward.html b/share/html/Ticket/Forward.html
     --- a/share/html/Ticket/Forward.html
    @@ -618,51 +607,39 @@
     --- a/t/web/ticket_forward.t
     +++ b/t/web/ticket_forward.t
     @@
    -     $m->submit_form(
    -         form_name => 'ForwardMessage',
    -         fields    => {
    --            To => 'rt-test, rt-to at example.com',
    -+            To => 'rt-to at example.com',
    -             Cc => 'rt-cc at example.com',
              },
              button => 'ForwardAndReturn'
          );
     -    $m->content_contains( 'Sent email successfully', 'sent mail msg' );
    --    $m->content_contains(
    --        'Forwarded Ticket to rt-test, rt-to at example.com, rt-cc at example.com',
    --        'txn msg' );
    -+    $m->content_contains( 'Forwarded Ticket', 'txn msg' );
    -     my ($mail) = RT::Test->fetch_caught_mails;
    -     like( $mail, qr!Subject: test forward!,           'Subject field' );
    --    like( $mail, qr!To: rt-test, rt-to\@example.com!, 'To field' );
    -+    like( $mail, qr!To: rt-to\@example.com!, 'To field' );
    -     like( $mail, qr!Cc: rt-cc\@example.com!,          'Cc field' );
    +     $m->content_contains(
    +         'Forwarded Ticket to <rt-to at example.com>, <rt-too at example.com>, <rt-cc at example.com>, root (Enoch Root)',
    +         'txn msg' );
    +@@
    +     like( $mail, qr!To: .*?rt-to\@example.com!i,      'To field' );
    +     like( $mail, qr!To: .*?rt-too\@example.com!i,     'To field' );
    +     like( $mail, qr!Cc: rt-cc\@example.com!i,         'Cc field' );
    +-    like( $mail, qr!Bcc: "root" <root\@localhost>!i,  'Bcc field' );
    ++    like( $mail, qr!Bcc: root\@localhost!i,  'Bcc field' );
          like( $mail, qr!This is a forward of ticket!,     'content' );
          like( $mail, qr!this is an attachment!,           'att content' );
    -@@
    -     $m->submit_form(
    -         form_name => 'ForwardMessage',
    -         fields    => {
    --            To  => 'rt-test, rt-to at example.com',
    -+            To  => 'rt-to at example.com',
    -             Cc  => 'rt-cc at example.com',
    -             Bcc => 'rt-bcc at example.com'
    +     like( $mail, qr!$att_name!,                       'att file name' );
    +@@
              },
              button => 'ForwardAndReturn'
          );
     -    $m->content_contains( 'Sent email successfully', 'sent mail msg' );
    --    $m->content_like(
    --qr/Forwarded Transaction #\d+ to rt-test, rt-to\@example.com, rt-cc\@example.com, rt-bcc\@example.com/,
    --        'txn msg'
    --    );
    -+    $m->content_like( qr/Forwarded Transaction #\d+/, 'txn msg' );
    -     my ($mail) = RT::Test->fetch_caught_mails;
    -     like( $mail, qr!Subject: test forward!,            'Subject field' );
    --    like( $mail, qr!To: rt-test, rt-to\@example.com!,  'To field' );
    -+    like( $mail, qr!To: rt-to\@example.com!,  'To field' );
    -     like( $mail, qr!Cc: rt-cc\@example.com!,           'Cc field' );
    -     like( $mail, qr!Bcc: rt-bcc\@example.com!,         'Bcc field' );
    +     $m->content_like(
    + qr/Forwarded .*?Transaction #\d+.*? to <rt-to\@example\.com>, <rt-too\@example\.com>, <rt-cc\@example\.com>, root (Enoch Root)/,
    +         'txn msg'
    +@@
    +     like( $mail, qr!To: .*rt-to\@example.com!i,        'To field' );
    +     like( $mail, qr!To: .*rt-too\@example.com!i,       'To field' );
    +     like( $mail, qr!Cc: rt-cc\@example.com!i,          'Cc field' );
    +-    like( $mail, qr!Bcc: "root" <root\@localhost>!i,   'Bcc field' );
    ++    like( $mail, qr!Bcc: root\@localhost!i,   'Bcc field' );
          like( $mail, qr!This is a forward of transaction!, 'content' );
    +     like( $mail, qr!$att_name!,                        'att file name' );
    +     like( $mail, qr!this is an attachment!,            'att content' );
     @@
              fields    => { To => 'rt-test at example.com', },
              button    => 'ForwardAndReturn'
    @@ -676,19 +653,16 @@
              button => 'ForwardAndReturn'
          );
     -    $m->content_contains( 'Sent email successfully', 'sent mail msg' );
    --    $m->content_like( qr/Forwarded Transaction #\d+ to rt-test\@example\.com/, 'txn msg' );
    -+    $m->content_like(qr/Forwarded Transaction #\d+/);
    +     $m->content_like( qr/Forwarded .*?Transaction #\d+.*? to <rt-test\@example\.com>/, 'txn msg' );
          my ($mail) = RT::Test->fetch_caught_mails;
          like( $mail, qr/Subject: test forward, empty content but attachments/, 'Subject field' );
    -     like( $mail, qr/To: rt-test\@example.com/,         'To field' );
     @@
              },
              button => 'ForwardAndReturn'
          );
     -    $m->content_contains( 'Sent email successfully', 'sent mail msg' );
    --    $m->content_like( qr/Forwarded Transaction #\d+ to rt-test\@example\.com/, 'txn msg' );
    +     $m->content_like( qr/Forwarded .*?Transaction #\d+.*? to <rt-test\@example\.com>/, 'txn msg' );
     -    
    -+    $m->content_like( qr/Forwarded Transaction #\d+/ );
     +
          # Forward ticket
          $m->follow_link_ok( { text => 'Forward', n => 1 }, 'follow 1st Forward' );
    @@ -698,9 +672,7 @@
              button => 'ForwardAndReturn'
          );
     -    $m->content_contains( 'Sent email successfully', 'sent mail msg' );
    --    $m->content_like( qr/Forwarded Ticket to rt-test\@example\.com/, 'txn msg' );
    -+    $m->content_like( qr/Forwarded Ticket/ );
    +     $m->content_like( qr/Forwarded Ticket to <rt-test\@example\.com>/, 'txn msg' );
      
          my ($forward_txn, $forward_ticket) = RT::Test->fetch_caught_mails;
    -     my $tag = qr/Fwd: \[example\.com #\d+\]/;
    -
    +
3:  007114c = 3:  69f5d38 Only add the default "This is a forward..." if no content is supplied
4:  fb3f005 ! 4:  ac432e6 Allow forwarding to set the subject
    @@ -49,7 +49,7 @@
              Cc             => '',
              Bcc            => '',
     @@
    -     }
    +     $args{$_} = join ", ", map { $_->format } RT::EmailParser->ParseEmailAddress( $args{$_} || '' ) for qw(To Cc Bcc);
      
          my $mime = MIME::Entity->build(
     -        Type => $args{'ContentType'},
5:  b109f0b < -:  ------- upgrade content for new customized forward messages
-:  ------- > 5:  2cabf12 upgrade content for new customized forward messages
-:  ------- > 6:  4edd7df update tests to reflect new subject changes
-:  ------- > 7:  ec4317f document "Forward" and "Forward Ticket" templates updates



More information about the Rt-commit mailing list