[Rt-commit] rt branch, 4.0/ticket-forward-clobbers-subject, created. rt-4.0.4-113-gb33481f
Jason May
jasonmay at bestpractical.com
Tue Dec 6 17:48:37 EST 2011
The branch, 4.0/ticket-forward-clobbers-subject has been created
at b33481ffa914f25c0363ba5a3927e695b42f0f1c (commit)
- Log -----------------------------------------------------------------
commit b33481ffa914f25c0363ba5a3927e695b42f0f1c
Author: Jason May <jasonmay at bestpractical.com>
Date: Tue Dec 6 17:48:27 2011 -0500
Respect Subject: lines in Forward Ticket templates
Currently they are completely clobbered with a 'Fwd:' subject, when the
message should use the Subject: line if one is provided.
diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm
index 8f6e190..d16eb3d 100644
--- a/lib/RT/Interface/Email.pm
+++ b/lib/RT/Interface/Email.pm
@@ -744,16 +744,19 @@ sub SendForward {
$mail->add_part( $entity );
my $from;
- my $subject = '';
- $subject = $txn->Subject if $txn;
- $subject ||= $ticket->Subject if $ticket;
+ unless (defined $mail->head->get('Subject')) {
+ my $subject = '';
+ $subject = $txn->Subject if $txn;
+ $subject ||= $ticket->Subject if $ticket;
+
+ unless ( RT->Config->Get('ForwardFromUser') ) {
+ # XXX: what if want to forward txn of other object than ticket?
+ $subject = AddSubjectTag( $subject, $ticket );
+ }
- unless ( RT->Config->Get('ForwardFromUser') ) {
- # XXX: what if want to forward txn of other object than ticket?
- $subject = AddSubjectTag( $subject, $ticket );
+ $mail->head->set( Subject => EncodeToMIME( String => "Fwd: $subject" ) );
}
- $mail->head->set( Subject => EncodeToMIME( String => "Fwd: $subject" ) );
$mail->head->set(
From => EncodeToMIME(
String => GetForwardFrom( Transaction => $txn, Ticket => $ticket )
diff --git a/t/web/ticket_forward.t b/t/web/ticket_forward.t
index be06ad9..1d74673 100644
--- a/t/web/ticket_forward.t
+++ b/t/web/ticket_forward.t
@@ -227,6 +227,41 @@ diag "Forward Transaction with attachments but no 'content' part" if $ENV{TEST_V
like( $mail, qr/image\/png/, 'att image content type' );
}
}
+RT::Test->clean_caught_mails;
+
+diag "Forward Ticket Template with a Subject: line" if $ENV{TEST_VERBOSE};
+{
+
+ require RT::Template;
+ my $template = RT::Template->new($RT::SystemUser);
+ $template->Load('Forward Ticket');
+
+ # prepend a Subject: line
+ $template->SetContent("Subject: OVERRIDING SUBJECT\n\n" . $template->Content);
+
+ my $ticket = RT::Test->create_ticket(
+ Subject => 'test ticket',
+ Queue => 1,
+ );
+
+ $m->goto_ticket($ticket->Id);
+
+ $m->follow_link_ok(
+ { id => 'page-actions-forward' },
+ 'follow 1st Forward to forward ticket'
+ );
+
+ $m->submit_form(
+ form_name => 'ForwardMessage',
+ fields => {
+ To => 'rt-to at example.com',
+ },
+ button => 'ForwardAndReturn'
+ );
+
+ my ($mail) = RT::Test->fetch_caught_mails;
+ like($mail, qr/Subject: OVERRIDING SUBJECT/);
+}
undef $m;
done_testing;
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list