[Rt-commit] rt branch, 3.999-trunk, updated. 60b14da35d94b431fde8f9791f13e50d881fc528

sartak at bestpractical.com sartak at bestpractical.com
Wed Nov 25 06:27:23 EST 2009


The branch, 3.999-trunk has been updated
       via  60b14da35d94b431fde8f9791f13e50d881fc528 (commit)
      from  bc05fcc190152f08d62c9989252f370da926aea4 (commit)

Summary of changes:
 lib/RT/Action/CreateTicket.pm |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

- Log -----------------------------------------------------------------
commit 60b14da35d94b431fde8f9791f13e50d881fc528
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Wed Nov 25 06:27:00 2009 -0500

    select_key_for_encryption though there's a lot more that needs to be ported

diff --git a/lib/RT/Action/CreateTicket.pm b/lib/RT/Action/CreateTicket.pm
index 8e432aa..a5985fa 100644
--- a/lib/RT/Action/CreateTicket.pm
+++ b/lib/RT/Action/CreateTicket.pm
@@ -200,6 +200,38 @@ sub setup_gnupg {
         render_as     => 'checkbox',
         default_value => $queue->encrypt,
     ));
+
+}
+
+sub select_key_for_encryption {
+    my $self    = shift;
+    my $email   = shift;
+    my $default = shift;
+
+    require RT::Crypt::GnuPG;
+    my %res = RT::Crypt::GnuPG::get_keys_for_encryption($email);
+
+    # move the preferred key to the top of the list
+    my $d;
+    my @keys = map {
+                   $_->{'fingerprint'} eq ( $default || '' )
+                       ?  do { $d = $_; () }
+                       : $_
+               }
+               @{ $res{'info'} };
+
+    @keys = sort { $b->{'trust_level'} <=> $a->{'trust_level'} } @keys;
+
+    unshift @keys, $d if defined $d;
+
+    return map {
+        my $display = _("%1 (trust: %2)", $_->{fingerprint}, $_->{trust_terse});
+
+        {
+            value   => $_->{fingerprint},
+            display => $display,
+        }
+    } @keys;
 }
 
 sub set_initial_priority {

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


More information about the Rt-commit mailing list