[rt-devel] [PATCH] canonicalize addresses in comments

Alan Sundell asundell+rt-devel at fas.harvard.edu
Wed Jul 9 14:54:37 EDT 2003


When creating a ticket with Ticket/Create.html and RT::Ticket::Create,
addresses in the Cc: and AdminCc: fields are canonicalized with
RT::User::CanonicalizeEmailAddress (via RT::User::LoadOrCreateByEmail).

When updating a ticket with Ticket/Update.html and RT::Ticket::Comment
or RT::Ticket::Correspond, addresses in the Cc: and Bcc: fields are not
canonicalized.

I realize that these fields and these methods are doing different things
under the hood, but, from the user perspective, this difference in
behavior is very confusing.

Shouldn't all email address input be canonicalized?


The patch below to RT::Ticket does just that for the Comment and
Correspond methods.  (I realize that calling the
RT::User::CanonicalizeEmailAddress method directly may not be the best
thing, but RT::CurrentUser does it, so I figured what the heck -- adjust
to taste.)

What do you folks think?

--Alan

--- rt-3-0-3/lib/RT/Ticket_Overlay.pm.orig	Thu Jul  3 16:14:06 2003
+++ rt-3-0-3/lib/RT/Ticket_Overlay.pm	Thu Jul  3 16:17:35 2003
@@ -2210,9 +2210,11 @@
     # The "NotifyOtherRecipients" scripAction will look for RT--Send-Cc: and
     # RT-Send-Bcc: headers
 
-    $args{'MIMEObj'}->head->add( 'RT-Send-Cc',  $args{'CcMessageTo'} )
+    $args{'MIMEObj'}->head->add( 'RT-Send-Cc',
+        RT::User::CanonicalizeEmailAddress(undef, $args{'CcMessageTo'}) )
 	if defined $args{'CcMessageTo'};
-    $args{'MIMEObj'}->head->add( 'RT-Send-Bcc', $args{'BccMessageTo'} )
+    $args{'MIMEObj'}->head->add( 'RT-Send-Bcc',
+        RT::User::CanonicalizeEmailAddress(undef, $args{'BccMessageTo'}) )
 	if defined $args{'BccMessageTo'};
 
     #Record the correspondence (write the transaction)
@@ -2278,9 +2280,11 @@
     # The "NotifyOtherRecipients" scripAction will look for RT-Send-Cc: and RT-Send-Bcc:
     # headers
 
-    $args{'MIMEObj'}->head->add( 'RT-Send-Cc',  $args{'CcMessageTo'} )
+    $args{'MIMEObj'}->head->add( 'RT-Send-Cc',
+        RT::User::CanonicalizeEmailAddress(undef, $args{'CcMessageTo'}) )
 	if defined $args{'CcMessageTo'};
-    $args{'MIMEObj'}->head->add( 'RT-Send-Bcc', $args{'BccMessageTo'} )
+    $args{'MIMEObj'}->head->add( 'RT-Send-Bcc',
+        RT::User::CanonicalizeEmailAddress(undef, $args{'BccMessageTo'}) )
 	if defined $args{'BccMessageTo'};
 
     #Record the correspondence (write the transaction)



More information about the Rt-devel mailing list