[Rt-commit] rt branch, 4.0/owner-autocomplete-default, created. rt-4.0.0rc4-31-g21233b6

Alex Vandiver alexmv at bestpractical.com
Mon Jan 31 14:59:11 EST 2011


The branch, 4.0/owner-autocomplete-default has been created
        at  21233b64b6a360b92b46d6fd5a8ce14696cb6db6 (commit)

- Log -----------------------------------------------------------------
commit 21233b64b6a360b92b46d6fd5a8ce14696cb6db6
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Sat Jan 29 00:16:19 2011 -0500

    Default the AutoComplete SelectOwner to the current owner
    
    The empty box, while not incorrect, confuses end-users.  This also
    makes the Reply page mirror the functionality that is seen on the
    Basics and People pages.

diff --git a/share/html/Elements/SelectOwnerAutocomplete b/share/html/Elements/SelectOwnerAutocomplete
index 86fd9c0..d9fc871 100644
--- a/share/html/Elements/SelectOwnerAutocomplete
+++ b/share/html/Elements/SelectOwnerAutocomplete
@@ -50,6 +50,7 @@ $Name           => undef
 $Objects        => []
 $Default        => 0
 $ValueAttribute => 'Name'
+$TicketObj      => undef
 </%ARGS>
 <%INIT>
 $ValueAttribute = 'Name' unless $ValueAttribute =~ /^(?:id|Name)$/;
@@ -60,6 +61,8 @@ if ( $Default and not $Default =~ /\D/ ) {
     my $user = RT::User->new( $session{'CurrentUser'} );
     $user->Load($Default);
     $value = $user->$ValueAttribute;
+} elsif (defined $TicketObj) {
+    $value = $TicketObj->OwnerObj->$ValueAttribute;
 }
 
 # Map to a string of RT::Ticket-1|RT::Queue-5|...
diff --git a/t/web/ticket_owner_autocomplete.t b/t/web/ticket_owner_autocomplete.t
index 787c8fd..3aa3f28 100644
--- a/t/web/ticket_owner_autocomplete.t
+++ b/t/web/ticket_owner_autocomplete.t
@@ -131,7 +131,7 @@ diag "on reply correct owner is selected";
     $agent_a->follow_link_ok( { id => 'page-actions-reply' }, 'Reply' );
 
     my $form = $agent_a->form_number(3);
-    is $form->value('Owner'), '', 'empty value selected';
+    is $form->value('Owner'), 'user_b', 'current user selected';
     $agent_a->submit;
 
     $ticket = RT::Ticket->new( RT->SystemUser );

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


More information about the Rt-commit mailing list