[Rt-commit] rt branch, 4.2/autosuggested-watcher-phrases, created. rt-4.1.13-290-gefc60b4

Thomas Sibley trs at bestpractical.com
Tue Jul 9 19:27:13 EDT 2013


The branch, 4.2/autosuggested-watcher-phrases has been created
        at  efc60b4dfcfa44d32a801ef88eb703b351196518 (commit)

- Log -----------------------------------------------------------------
commit efc60b4dfcfa44d32a801ef88eb703b351196518
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue Jul 9 16:23:19 2013 -0700

    Submit the full formatted email address for auto-suggested new watchers
    
    This lets the phrase be used as the real name if a new user is created.
    Otherwise, RT presents the real name and then appears to lose it as soon
    as the suggested watcher is added.  It's bugged me for a while, but I
    didn't realize the fix was so simple until today.
    
    A few new tests to ensure we don't break this functionality in the
    future.

diff --git a/share/html/Ticket/Elements/AddWatchers b/share/html/Ticket/Elements/AddWatchers
index 28e2d4b..8e41b09 100644
--- a/share/html/Ticket/Elements/AddWatchers
+++ b/share/html/Ticket/Elements/AddWatchers
@@ -84,7 +84,7 @@
 <tr><td>
 <&/Elements/SelectWatcherType, Name => "WatcherTypeEmail".$counter &>
 </td><td>
-<input type="hidden" name="WatcherAddressEmail<%$counter%>" value="<%$email->address%>">
+<input type="hidden" name="WatcherAddressEmail<%$counter%>" value="<%$email->format%>">
 <%$email->format%>
 </td></tr>
 % }
diff --git a/t/ticket/add-watchers.t b/t/ticket/add-watchers.t
index 37a04c7..12b0bb3 100644
--- a/t/ticket/add-watchers.t
+++ b/t/ticket/add-watchers.t
@@ -1,4 +1,4 @@
-use RT::Test nodata => 1, tests => 32;
+use RT::Test nodata => 1, tests => 34;
 
 use strict;
 use warnings;
@@ -87,6 +87,13 @@ ok(  $rv, "user can add self as Cc by username" );
 ($rv, $msg) = $ticket2->AddWatcher( Type => 'Requestor', Email => $user->Name );
 ok(  $rv, "user can add self as Requestor by username" );
 
+# Add an email address with a phrase
+($rv, $msg) = $ticket->AddWatcher( Type => 'Cc', Email => q["Foo Bar" <foo at example.com>] );
+ok $rv, "Added email address with phrase" or diag $msg;
+
+my $foo = RT::Test->load_or_create_user( EmailAddress => 'foo at example.com' );
+is $foo->RealName, "Foo Bar", "RealName matches";
+
 # Queue watcher tests
 $principal->RevokeRight( Right => 'Watch'  , Object => $queue );
 ok( !$user->HasRight( Right => 'Watch',        Object => $queue ), "user queue watch right revoked" );
diff --git a/t/web/ticket_modify_people.t b/t/web/ticket_modify_people.t
index 5b59dbb..cefbf91 100644
--- a/t/web/ticket_modify_people.t
+++ b/t/web/ticket_modify_people.t
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 
-use RT::Test tests => 23;
+use RT::Test tests => 25;
 
 my $root = RT::Test->load_or_create_user( Name => 'root' );
 my $group_foo = RT::Group->new($RT::SystemUser);
@@ -108,6 +108,16 @@ ok(
     'got link to modify group'
 );
 
+$m->submit_form_ok({
+    with_fields => {
+        WatcherTypeEmail1    => 'Cc',
+        WatcherAddressEmail1 => '"Foo Bar" <foo at example.com>',
+    },
+    button => 'SubmitTicket',
+}, "Added email with phrase as watcher");
+
+my $foo = RT::Test->load_or_create_user( EmailAddress => 'foo at example.com' );
+is $foo->RealName, "Foo Bar", "RealName matches";
 
 # TODO test Add|Delete people
 

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


More information about the Rt-commit mailing list