[Rt-commit] rt branch, 3.999-trunk, updated. 1c0f17c7eb27fd39d318e8b6348b4c3632be00e3

sartak at bestpractical.com sartak at bestpractical.com
Sun Nov 29 21:51:22 EST 2009


The branch, 3.999-trunk has been updated
       via  1c0f17c7eb27fd39d318e8b6348b4c3632be00e3 (commit)
       via  3c58dc816268857defde77a13d534805af225803 (commit)
       via  b727ab1be959a2542d1dd80aa832079c66d79a73 (commit)
       via  bc801a068813d6706c758b15fd1dabb90b380b05 (commit)
       via  e7b8b6e4d1454d0b2d0b9546d1db8b9a1f4fcd33 (commit)
       via  a0171732465b4cc3e8f67254f49238739ec20f60 (commit)
       via  218346b51086f6b8ab2c267ee4584201ac19935e (commit)
       via  09ec68c7166b247c1c5efec7b89daff11a03d2cc (commit)
       via  0d4a3c2321511d8ae20619b7410ed2f3c8bfc4da (commit)
       via  ebf259df66c72ef2b6dcb923a094a57a984eba8b (commit)
       via  173bd9da0d9ed4e88399b514718fb158e2a389f2 (commit)
       via  e38126a641cf1cab75ab92e9070c97534f563f05 (commit)
       via  0e27c2e83c04f093f8336f3a6b76319427808a06 (commit)
       via  9cd2efb457222d8872d1d458849a975d93ca3b2d (commit)
       via  aa39b05b1e8fad98f2024a7632f3a4a28987b9a2 (commit)
      from  31b377b2ad98c4187a1ac2245a171d7f5d8f5240 (commit)

Summary of changes:
 lib/RT/Interface/Email.pm            |   59 ++++++++++++++++++++++------------
 lib/RT/Interface/Email/Auth/GnuPG.pm |    4 +-
 lib/RT/Model/Ticket.pm               |   17 ++++++++-
 lib/RT/ScripAction/SendEmail.pm      |    5 ++-
 t/mail/gnupg-realmail.t              |    2 +-
 t/web/crypt-gnupg.t                  |    8 +++--
 t/web/gnupg-outgoing.t               |    6 +++-
 7 files changed, 69 insertions(+), 32 deletions(-)

- Log -----------------------------------------------------------------
commit aa39b05b1e8fad98f2024a7632f3a4a28987b9a2
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Nov 26 15:42:16 2009 -0500

    Add sign/encrypt headers

diff --git a/lib/RT/Model/Ticket.pm b/lib/RT/Model/Ticket.pm
index 4a9813d..440ba81 100755
--- a/lib/RT/Model/Ticket.pm
+++ b/lib/RT/Model/Ticket.pm
@@ -405,6 +405,8 @@ sub create {
         resolved            => undef,
         told                => undef,
         mime_obj            => undef,
+        sign                => 0,
+        encrypt             => 0,
         _record_transaction => 1,
         dry_run             => 0,
         @_
@@ -811,6 +813,12 @@ sub create {
         );
     }
 
+    foreach my $argument (qw(encrypt sign)) {
+        my $header = "X-RT-" . ucfirst($argument);
+        $args{'mime_obj'}->head->add( $header => $args{$argument} )
+            if defined $args{$argument};
+    }
+
     if ($args{'attachments'}) {
         # Once multi-upload works we probably won't have to do this coercion
         $args{'attachments'} = [$args{'attachments'}]

commit 9cd2efb457222d8872d1d458849a975d93ca3b2d
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Nov 27 17:52:11 2009 -0500

    Bump up $Test::Builder::Level so we can see where failures are coming from

diff --git a/t/web/gnupg-outgoing.t b/t/web/gnupg-outgoing.t
index e4f1750..9b765c1 100644
--- a/t/web/gnupg-outgoing.t
+++ b/t/web/gnupg-outgoing.t
@@ -256,6 +256,7 @@ foreach my $mail ( map cleanup_headers($_), @{ $mail{'signed_encrypted'} } ) {
 
 sub create_a_ticket {
     my %args = (@_);
+    local $Test::Builder::Level = $Test::Builder::Level + 1;
 
     RT::Test->clean_caught_mails;
 
@@ -289,6 +290,7 @@ sub create_a_ticket {
 sub update_ticket {
     my $tid = shift;
     my %args = (@_);
+    local $Test::Builder::Level = $Test::Builder::Level + 1;
 
     RT::Test->clean_caught_mails;
 
@@ -319,6 +321,8 @@ sub check_text_emails {
     my %args = %{ shift @_ };
     my @mail = @_;
 
+    local $Test::Builder::Level = $Test::Builder::Level + 1;
+
     ok scalar @mail, "got some mail";
     for my $mail (@mail) {
         if ( $args{'encrypt'} ) {

commit 0e27c2e83c04f093f8336f3a6b76319427808a06
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Nov 27 18:07:08 2009 -0500

    Canonicalize the "requestors" parameter into "requestor"

diff --git a/lib/RT/Model/Ticket.pm b/lib/RT/Model/Ticket.pm
index 440ba81..8b5b8ec 100755
--- a/lib/RT/Model/Ticket.pm
+++ b/lib/RT/Model/Ticket.pm
@@ -475,6 +475,10 @@ sub create {
     $args{'priority'} = $args{'initial_priority'}
         unless defined $args{'priority'};
 
+    # XXX we should become consistent about requestor vs requestors
+    $args{'requestor'} = delete $args{'requestors'}
+        unless $args{'requestor'};
+
 # Initial message {{{
     if (!$args{mime_obj}) {
         my $sigless = RT::Interface::Web::strip_content(

commit e38126a641cf1cab75ab92e9070c97534f563f05
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Nov 27 18:11:44 2009 -0500

    Fix plan

diff --git a/t/web/gnupg-outgoing.t b/t/web/gnupg-outgoing.t
index 9b765c1..3649628 100644
--- a/t/web/gnupg-outgoing.t
+++ b/t/web/gnupg-outgoing.t
@@ -10,7 +10,7 @@ plan skip_all => 'GnuPG required.'
 plan skip_all => 'gpg executable is required.'
     unless RT::Test->find_executable('gpg');
 
-plan tests => 492;
+plan tests => 508;
 
 use RT::ScripAction::SendEmail;
 use File::Temp qw(tempdir);

commit 173bd9da0d9ed4e88399b514718fb158e2a389f2
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Nov 27 18:12:52 2009 -0500

    Plan fix

diff --git a/t/web/crypt-gnupg.t b/t/web/crypt-gnupg.t
index 6d1db3a..2fe032c 100644
--- a/t/web/crypt-gnupg.t
+++ b/t/web/crypt-gnupg.t
@@ -9,7 +9,7 @@ plan skip_all => 'GnuPG required.'
 plan skip_all => 'gpg executable is required.'
     unless RT::Test->find_executable('gpg');
 
-plan tests => 93;
+plan tests => 97;
 
 use RT::ScripAction::SendEmail;
 

commit ebf259df66c72ef2b6dcb923a094a57a984eba8b
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Nov 27 20:16:21 2009 -0500

    Wrap all non-arrayref ref types in [] for ticket->create
    
        We want to wrap REFs, one of which is passed in t/api/tickets.t

diff --git a/lib/RT/Model/Ticket.pm b/lib/RT/Model/Ticket.pm
index 8b5b8ec..af69cca 100755
--- a/lib/RT/Model/Ticket.pm
+++ b/lib/RT/Model/Ticket.pm
@@ -608,7 +608,7 @@ sub create {
     # _outside_ the transaction, so we don't get into ticket creation races
     foreach my $type ( $self->roles ) {
 
-        $args{$type} = [ $args{$type} ] unless ref $args{$type};
+        $args{$type} = [ $args{$type} ] unless ref $args{$type} eq 'ARRAY';
         foreach my $watcher ( grep $_, splice @{ $args{$type} } ) {
             if ( $watcher =~ /^\d+$/ ) {
                 push @{ $args{$type} }, $watcher;

commit 0d4a3c2321511d8ae20619b7410ed2f3c8bfc4da
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Nov 27 20:52:30 2009 -0500

    Typo fix

diff --git a/t/mail/gnupg-realmail.t b/t/mail/gnupg-realmail.t
index a454f9c..4af0f8a 100644
--- a/t/mail/gnupg-realmail.t
+++ b/t/mail/gnupg-realmail.t
@@ -76,7 +76,7 @@ for my $usage (qw/signed encrypted signed&encrypted/) {
 
 $m->warnings_like(
     [ (qr/Recipient 'ternus\@mit.edu' is unusable/ ) x 16 ],
-    "got Recipient 'ternus\@mit.edu  is unusable warning"
+    "got Recipient 'ternus\@mit.edu' is unusable warning"
 );
 
 sub email_ok {

commit 09ec68c7166b247c1c5efec7b89daff11a03d2cc
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Nov 27 20:55:03 2009 -0500

    Tidy

diff --git a/t/web/crypt-gnupg.t b/t/web/crypt-gnupg.t
index 2fe032c..ca76bcf 100644
--- a/t/web/crypt-gnupg.t
+++ b/t/web/crypt-gnupg.t
@@ -394,7 +394,9 @@ ok(my $id = $tick->id, 'created ticket for owner-without-pubkey');
 $tick = RT::Model::Ticket->new(current_user => RT->system_user );
 $tick->create(subject => 'owner has pubkey', queue => 'general',
               owner => 'root');
-ok($id = $tick->id, 'created ticket for owner-with-pubkey');
+ok($tick->id, 'created ticket for owner-with-pubkey');
+
+
 my $mail = << "MAIL";
 Subject: Nokey requestor
 From: nokey\@example.com
@@ -402,7 +404,7 @@ To: general\@example.com
 
 hello
 MAIL
- 
+
 ((my $status), $id) = RT::Test->send_via_mailgate($mail);
 $m->warnings_like( qr/Recipient 'nokey\@example.com' is unusable/ );
 

commit 218346b51086f6b8ab2c267ee4584201ac19935e
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Nov 27 20:58:36 2009 -0500

    Make sure we set X-RT-Sign not X-RT-sign

diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm
index 712124c..b97f6ab 100755
--- a/lib/RT/Interface/Email.pm
+++ b/lib/RT/Interface/Email.pm
@@ -344,11 +344,12 @@ sub send_email {
 
         foreach my $argument (qw(sign encrypt)) {
             next if defined $args{$argument};
+            my $header = "X-RT-" . ucfirst($argument);
 
             if ( $attachment
-                && defined $attachment->get_header("X-RT-$argument") )
+                && defined $attachment->get_header($header) )
             {
-                $crypt{$argument} = $attachment->get_header("X-RT-$argument");
+                $crypt{$argument} = $attachment->get_header($header);
             } elsif ( $args{'ticket'} ) {
                 $crypt{$argument} = $args{'ticket'}->queue->$argument();
             }

commit a0171732465b4cc3e8f67254f49238739ec20f60
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Nov 27 20:59:56 2009 -0500

    More X-RT-sign avoidance

diff --git a/lib/RT/Model/Ticket.pm b/lib/RT/Model/Ticket.pm
index af69cca..53e7946 100755
--- a/lib/RT/Model/Ticket.pm
+++ b/lib/RT/Model/Ticket.pm
@@ -1306,7 +1306,8 @@ sub _record_note {
     }
 
     foreach my $argument (qw(encrypt sign)) {
-        $args{'mime_obj'}->head->add( "X-RT-$argument" => $args{$argument} )
+        my $header = "X-RT-" . ucfirst($argument);
+        $args{'mime_obj'}->head->add( $header => $args{$argument} )
             if defined $args{$argument};
     }
 
diff --git a/lib/RT/ScripAction/SendEmail.pm b/lib/RT/ScripAction/SendEmail.pm
index 29b16af..7c61a06 100755
--- a/lib/RT/ScripAction/SendEmail.pm
+++ b/lib/RT/ScripAction/SendEmail.pm
@@ -113,10 +113,11 @@ sub commit {
 
         my %crypt;
         foreach my $argument (qw(sign encrypt)) {
+            my $header = "X-RT-" . ucfirst($argument);
             if ( $attachment
-                && defined $attachment->get_header("X-RT-$argument") )
+                && defined $attachment->get_header($header) )
             {
-                $crypt{$argument} = $attachment->get_header("X-RT-$argument");
+                $crypt{$argument} = $attachment->get_header($header);
             } else {
                 $crypt{$argument} = $self->ticket_obj->queue->$argument();
             }

commit e7b8b6e4d1454d0b2d0b9546d1db8b9a1f4fcd33
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Nov 27 21:06:20 2009 -0500

    Fix more inconsistent headers

diff --git a/lib/RT/Interface/Email/Auth/GnuPG.pm b/lib/RT/Interface/Email/Auth/GnuPG.pm
index 417ab5a..cafa497 100644
--- a/lib/RT/Interface/Email/Auth/GnuPG.pm
+++ b/lib/RT/Interface/Email/Auth/GnuPG.pm
@@ -74,7 +74,7 @@ sub get_current_user {
         @_
     );
 
-    $args{'message'}->head->delete($_) for qw(X-RT-GnuPG-status X-RT-Incoming-Encryption
+    $args{'message'}->head->delete($_) for qw(X-RT-GnuPG-Status X-RT-Incoming-Encryption
         X-RT-Incoming-Signature X-RT-Privacy);
 
     my $msg = $args{'message'}->dup;
@@ -102,7 +102,7 @@ sub get_current_user {
         Data        => ${ $args{'raw_message_ref'} },
     );
 
-    $args{'message'}->head->add( 'X-RT-GnuPG-status' => $_->{'status'} ) foreach @res;
+    $args{'message'}->head->add( 'X-RT-GnuPG-Status' => $_->{'status'} ) foreach @res;
     $args{'message'}->head->add( 'X-RT-Privacy' => 'PGP' );
 
     # XXX: first entity only for now

commit bc801a068813d6706c758b15fd1dabb90b380b05
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Nov 27 21:14:15 2009 -0500

    Doc fixes

diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm
index b97f6ab..e4cf3e6 100755
--- a/lib/RT/Interface/Email.pm
+++ b/lib/RT/Interface/Email.pm
@@ -139,7 +139,7 @@ sub check_for_suspicious_sender {
 
     #TODO: better algorithms needed here - there is no standards for
     #bounces, so it's very difficult to separate them from anything
-    #else.  At the other hand, the Return-To address is only ment to be
+    #else.  At the other hand, the Return-To address is only meant to be
     #used as an error channel, we might want to put up a separate
     #Return-To address which is treated differently.
 
@@ -203,22 +203,38 @@ Sends an error message. Takes a param hash:
 
 =over 4
 
-=item from - sender's address, by default is 'correspond_address';
+=item from
 
-=item to - recipient, by default is 'OwnerEmail';
+sender's address, by default is 'correspond_address';
 
-=item bcc - optional Bcc recipients;
+=item to
 
-=item subject - subject of the message, default is 'There has been an error';
+recipient, by default is 'OwnerEmail';
 
-=item explanation - main content of the error, default value is 'Unexplained error';
+=item bcc
 
-=item mime_obj - optional MIME entity that's attached to the error mail, as well we
+optional Bcc recipients;
+
+=item subject
+
+subject of the message, default is 'There has been an error';
+
+=item explanation
+
+main content of the error, default value is 'Unexplained error';
+
+=item mime_obj
+
+optional MIME entity that's attached to the error mail, as well we
 add 'In-Reply-To' field to the error that points to this message.
 
-=item attach - optional text that attached to the error as 'message/rfc822' part.
+=item attach
+
+optional text that attached to the error as 'message/rfc822' part.
+
+=item log_level
 
-=item log_level - log level under which we should write explanation message into the
+log level under which we should write explanation message into the
 log, by default we log it as errorical.
 
 =back

commit b727ab1be959a2542d1dd80aa832079c66d79a73
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Nov 27 21:16:51 2009 -0500

    Fix for an awesome automatic replacement

diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm
index e4cf3e6..6a6152e 100755
--- a/lib/RT/Interface/Email.pm
+++ b/lib/RT/Interface/Email.pm
@@ -818,7 +818,7 @@ sub create_user {
     return $CurrentUser;
 }
 
-=head2 parse_cc->member_emails_as_string_from_head HASH
+=head2 parse_cc_addresses_from_head HASH
 
 Takes a hash containing queue_obj, Head and current_user objects.
 Returns a list of all email addresses in the To and Cc

commit 3c58dc816268857defde77a13d534805af225803
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Nov 27 21:17:04 2009 -0500

    More doc fixes

diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm
index 6a6152e..2542a41 100755
--- a/lib/RT/Interface/Email.pm
+++ b/lib/RT/Interface/Email.pm
@@ -300,21 +300,21 @@ and hasn't been sent.
 
 =head3 Signing and Encrypting
 
-This function as well signs and/or encrypts the message according to
+This function also signs and/or encrypts the message according to
 headers of a transaction's attachment or properties of a ticket's queue.
 To get full access to the configuration ticket and/or transaction
-arguments must be provided, but you can force behaviour using Sign
-and/or encrypt arguments.
+arguments must be provided, but you can force behaviour using the C<sign>
+and/or C<encrypt> arguments.
 
 The following precedence of arguments are used to figure out if
 the message should be encrypted and/or signed:
 
-* if sign or encrypt argument is defined then its value is used
+* if C<sign> or C<encrypt> argument is defined then its value is used
 
-* else if transaction's first attachment has X-RT-Sign or X-RT-Encrypt
+* else if transaction's first attachment has C<X-RT-Sign> or C<X-RT-Encrypt>
 header field then it's value is used
 
-* else properties of a queue of the ticket are used.
+* else properties of the queue of the ticket are used.
 
 =cut
 
@@ -820,10 +820,10 @@ sub create_user {
 
 =head2 parse_cc_addresses_from_head HASH
 
-Takes a hash containing queue_obj, Head and current_user objects.
+Takes a hash containing C<queue_obj>, C<head> and C<current_user> objects.
 Returns a list of all email addresses in the To and Cc
-headers b<except> the current Queue\'s email addresses, the CurrentUser\'s
-email address  and anything that the configuration sub RT::is_rt_address matches.
+headers b<except> the current Queue's email addresses, the CurrentUser's
+email address and anything that the configuration L<RT/is_rt_address> matches.
 
 =cut
 

commit 1c0f17c7eb27fd39d318e8b6348b4c3632be00e3
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Nov 27 21:17:34 2009 -0500

    POD tags are case sensitive, at least according to vim's syntax highlighting :)

diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm
index 2542a41..fdd09a9 100755
--- a/lib/RT/Interface/Email.pm
+++ b/lib/RT/Interface/Email.pm
@@ -822,7 +822,7 @@ sub create_user {
 
 Takes a hash containing C<queue_obj>, C<head> and C<current_user> objects.
 Returns a list of all email addresses in the To and Cc
-headers b<except> the current Queue's email addresses, the CurrentUser's
+headers B<except> the current Queue's email addresses, the CurrentUser's
 email address and anything that the configuration L<RT/is_rt_address> matches.
 
 =cut

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


More information about the Rt-commit mailing list