[Rt-commit] rt branch, 4.4-trunk, updated. rt-4.4.3-111-g17a2acaaf
? sunnavy
sunnavy at bestpractical.com
Fri Dec 14 14:37:44 EST 2018
The branch, 4.4-trunk has been updated
via 17a2acaafc7c747cd301d4ab944721a16f246c4f (commit)
via 63531aee3577ee66e6f74a8973a919bf49c901f0 (commit)
via 57275dfcfaa76b11985ffb18255d22455b5c0de9 (commit)
from 5c105bebce6b6d70118f355209700d3e539fc064 (commit)
Summary of changes:
lib/RT/Action/SendEmail.pm | 3 ++-
t/mail/add-tickets.t | 58 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 60 insertions(+), 1 deletion(-)
create mode 100644 t/mail/add-tickets.t
- Log -----------------------------------------------------------------
commit 57275dfcfaa76b11985ffb18255d22455b5c0de9
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Mon Jan 30 16:18:01 2017 -0500
Add tests to confirm content type when using AddTickets in SendEmail
diff --git a/t/mail/add-tickets.t b/t/mail/add-tickets.t
new file mode 100644
index 000000000..450a160ca
--- /dev/null
+++ b/t/mail/add-tickets.t
@@ -0,0 +1,58 @@
+use strict;
+use warnings;
+
+use RT::Test tests => undef;
+
+my $user = RT::Test->load_or_create_user(
+ Name => 'user1',
+ EmailAddress => 'user1 at example.com',
+);
+
+ok(
+ RT::Test->set_rights(
+ { Principal => 'Everyone', Right => [qw/CreateTicket ReplyToTicket CommentOnTicket/] },
+ { Principal => 'Requestor', Right => [qw/ShowTicket/] },
+ ),
+ 'set rights'
+);
+
+my $ticket_a = RT::Test->create_ticket(
+ Queue => 'General',
+ Subject => 'ticket A',
+ Requestor => 'user1 at example.com',
+ Content => "First ticket",
+ );
+
+my $ticket_b = RT::Test->create_ticket(
+ Queue => 'General',
+ Subject => 'ticket b',
+ Requestor => 'user1 at example.com',
+ Content => "Second ticket",
+ );
+
+my ($baseurl, $m) = RT::Test->started_ok;
+ok $m->login( 'root', 'password' ), 'logged in as root';
+
+RT::Test->clean_caught_mails;
+
+# AttachTickets is mostly used in RTIR
+diag "Submit a comment with attached tickets";
+
+$m->get_ok('/Ticket/Display.html?id=' . $ticket_b->Id);
+$m->follow_link_ok({text => "Comment"}, "Followed link to comment");
+$m->form_name('TicketUpdate');
+$m->field('UpdateCc', 'user1 at example.com');
+$m->field('UpdateContent', 'some content');
+$m->field('AttachTickets', $ticket_a->Id);
+$m->click('SubmitTicket');
+is( $m->status, 200, "request successful" );
+
+my @mail = RT::Test->fetch_caught_mails;
+ok @mail, "got some outgoing emails";
+
+# Match the first occurance of Content-Type in the email. This should be the
+# outermost part
+$mail[0] =~ /^.*?Content\-Type\: (.*?)\;/sm;
+is( $1, 'multipart/mixed', 'Outer message is multipart mixed');
+
+done_testing;
commit 63531aee3577ee66e6f74a8973a919bf49c901f0
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Mon Jan 30 16:20:13 2017 -0500
Update AddTicket to force multipart/mixed email
For html email, RT makes a plain text version, changing the
top level email Content-Type to multipart/alternative to indicate
there are several versions of the same email available. When adding
additional attachments, like another ticket, force the top level
email Content-Type to multipart/mixed to indicate there are additional
attachments, not just alternate versions of the same email.
This issue was observed when using the attach tickets feature in
RTIR.
diff --git a/lib/RT/Action/SendEmail.pm b/lib/RT/Action/SendEmail.pm
index 1fa479bdc..88ad3bd3d 100644
--- a/lib/RT/Action/SendEmail.pm
+++ b/lib/RT/Action/SendEmail.pm
@@ -542,7 +542,8 @@ sub AddTicket {
}
if ( $ticket_mime->parts ) {
my $email_mime = $self->TemplateObj->MIMEObj;
- $email_mime->make_multipart;
+ $email_mime->make_multipart( 'mixed', Force => 1 )
+ unless $email_mime->effective_type eq 'multipart/mixed';
$email_mime->add_part($ticket_mime);
}
return;
commit 17a2acaafc7c747cd301d4ab944721a16f246c4f
Merge: 5c105bebc 63531aee3
Author: sunnavy <sunnavy at bestpractical.com>
Date: Sat Dec 15 03:25:59 2018 +0800
Merge branch '4.4/email-addtickets-multipart' into 4.4-trunk
-----------------------------------------------------------------------
More information about the rt-commit
mailing list