[Rt-commit] rt branch, html-templates, updated. rt-3.9.6-43-g9d8002b

Thomas Sibley trs at bestpractical.com
Thu Dec 2 18:42:26 EST 2010


The branch, html-templates has been updated
       via  9d8002beaf841d73a995c40bfc274d55f94a806e (commit)
       via  b2909caede004be56343b496785e217aa4286438 (commit)
       via  a6ba5308e9da2e1acc7673b51dbd96247bcf3a0c (commit)
       via  d699852b23da9e12cec57735977e6fc381dd7140 (commit)
      from  aa45d412e55470773ca6adc05142c2e55cf8a767 (commit)

Summary of changes:
 etc/initialdata           |    2 +-
 etc/upgrade/3.9.7/content |    2 +-
 lib/RT/Interface/Email.pm |    1 +
 lib/RT/Test.pm            |   11 +++++---
 t/mail/html-outgoing.t    |   66 +++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 76 insertions(+), 6 deletions(-)
 create mode 100644 t/mail/html-outgoing.t

- Log -----------------------------------------------------------------
commit d699852b23da9e12cec57735977e6fc381dd7140
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Dec 2 14:25:46 2010 -0500

    Match the Transaction in HTML acted on line to the plain text

diff --git a/etc/initialdata b/etc/initialdata
index 32073c8..96506ec 100644
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -273,7 +273,7 @@ you may reply to this message.</p>
        Content     => 'RT-Attach-Message: yes
 Content-Type: text/html
 
-<b>{$Transaction->CreatedAsString}: {$Transaction->CreatorObj->Name} updated ticket <a href="{RT->Config->Get("WebURL")}Ticket/Display.html?id={$Ticket->id}">{$Ticket->id}</a>.</b>
+<b>{$Transaction->CreatedAsString}: Request <a href="{RT->Config->Get("WebURL")}Ticket/Display.html?id={$Ticket->id}">{$Ticket->id}</a> was acted upon by {$Transaction->CreatorObj->Name}.</b>
 <br>
 <table border="0">
 <tr><td align="right"><b>Transaction:</b></td><td>{$Transaction->Description}</td></tr>
diff --git a/etc/upgrade/3.9.7/content b/etc/upgrade/3.9.7/content
index 28032f3..8ab9432 100755
--- a/etc/upgrade/3.9.7/content
+++ b/etc/upgrade/3.9.7/content
@@ -33,7 +33,7 @@ you may reply to this message.</p>
        Content     => 'RT-Attach-Message: yes
 Content-Type: text/html
 
-<b>{$Transaction->CreatedAsString}: {$Transaction->CreatorObj->Name} updated ticket <a href="{RT->Config->Get("WebURL")}Ticket/Display.html?id={$Ticket->id}">{$Ticket->id}</a>.</b>
+<b>{$Transaction->CreatedAsString}: Request <a href="{RT->Config->Get("WebURL")}Ticket/Display.html?id={$Ticket->id}">{$Ticket->id}</a> was acted upon by {$Transaction->CreatorObj->Name}.</b>
 <br>
 <table border="0">
 <tr><td align="right"><b>Transaction:</b></td><td>{$Transaction->Description}</td></tr>

commit a6ba5308e9da2e1acc7673b51dbd96247bcf3a0c
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Dec 2 14:26:10 2010 -0500

    Fix the switch_templates_ok test

diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index 09af6c0..2c05449 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -812,10 +812,13 @@ sub switch_templates_ok {
     my $type = shift;
 
     my ($exit, $output) = $self->switch_templates_to($type);
-
-    Test::More::ok(not ($exit >> 8), "Switched templates to $type cleanly");
-    diag("**** etc/upgrade/switch-templates-to exited with $num:\n$output")
-        if $exit >> 8;
+    
+    if ($exit >> 8) {
+        Test::More::fail("Switched templates to $type cleanly");
+        diag("**** etc/upgrade/switch-templates-to exited with ".($exit >> 8).":\n$output");
+    } else {
+        Test::More::pass("Switched templates to $type cleanly");
+    }
 
     return ($exit, $output);
 }

commit b2909caede004be56343b496785e217aa4286438
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Dec 2 15:27:16 2010 -0500

    Don't make double links when converting to text

diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm
index 1cd9d30..1afe7b9 100755
--- a/lib/RT/Interface/Email.pm
+++ b/lib/RT/Interface/Email.pm
@@ -1858,6 +1858,7 @@ sub ConvertHTMLToText {
             before_link     => '',
             after_link      => ' (%l)',
             footnote        => '',
+            skip_linked_urls => 1,
         }
     );
 }

commit 9d8002beaf841d73a995c40bfc274d55f94a806e
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Dec 2 18:41:23 2010 -0500

    Add a basic first test of HTML notifications
    
    This tests the Transaction and Autoreply templates in HTML.

diff --git a/t/mail/html-outgoing.t b/t/mail/html-outgoing.t
new file mode 100644
index 0000000..0cb2ce7
--- /dev/null
+++ b/t/mail/html-outgoing.t
@@ -0,0 +1,66 @@
+use strict;
+use warnings;
+use RT::Test tests => undef;
+BEGIN {
+    plan skip_all => 'Email::Abstract and Test::Email required.'
+        unless eval { require Email::Abstract; require Test::Email; 1 };
+    plan 'no_plan';
+}
+
+RT::Test->switch_templates_ok('html');
+
+use RT::Test::Email;
+
+my $root = RT::User->new(RT->SystemUser);
+$root->Load('root');
+
+# Set root as admincc
+my $q = RT::Queue->new(RT->SystemUser);
+$q->Load('General');
+my ($ok, $msg) = $q->AddWatcher( Type => 'AdminCc', PrincipalId => $root->Id );
+ok($ok, "Added root as a watcher on the General queue");
+
+# Create a couple users to test notifications
+my %users;
+for my $user_name (qw(enduser tech)) {
+    my $user = $users{$user_name} = RT::User->new(RT->SystemUser);
+    $user->Create( Name => ucfirst($user_name),
+                   Privileged => 1,
+                   EmailAddress => $user_name.'@example.com');
+    my ($val, $msg);
+    ($val, $msg) = $user->PrincipalObj->GrantRight(Object =>$q, Right => $_)
+        for qw(ModifyTicket OwnTicket ShowTicket);
+}
+
+my $t = RT::Ticket->new(RT->SystemUser);
+my ($tid, $ttrans, $tmsg);
+
+# Autoreply and AdminCc (Transaction)
+mail_ok {
+    ($tid, $ttrans, $tmsg) = 
+        $t->Create(Subject => "The internet is broken",
+                   Owner => 'Tech', Requestor => 'Enduser',
+                   Queue => 'General');
+} { from    => qr/The default queue/,
+    to      => 'enduser at example.com',
+    subject => qr/\Q[example.com #1] AutoReply: The internet is broken\E/,
+    body    => qr{
+        Content-Type:\stext/plain.+?
+        trouble\sticket\sregarding\sThe\sinternet\sis\sbroken.+?
+        Content-Type:\stext/html.+?
+        trouble\sticket\sregarding\s<b>The\sinternet\sis\sbroken</b>
+    }xs,
+    'Content-Type' => qr{multipart},
+},{ from    => qr/RT System/,
+    bcc     => 'root at localhost',
+    subject => qr/\Q[example.com #1] The internet is broken\E/,
+    body    => qr{
+        Content-Type:\stext/plain.+?
+        Request\s1\s\(http://localhost:\d+/Ticket/Display\.html\?id=1\)\s+was\sacted\supon\sby\sRT_System.+?
+        Content-Type:\stext/html.+?
+        Request\s<a\shref="http://localhost:\d+/Ticket/Display\.html\?id=1">1</a>\swas\sacted\supon\sby\sRT_System\.</b>
+    }xs,
+    'Content-Type' => qr{multipart},
+};
+
+

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


More information about the Rt-commit mailing list