janinedog: (Default)
Janine ([personal profile] janinedog) wrote in [site community profile] changelog2009-04-05 02:11 am

[dw-free] Invite code page should refresh with "just sent" code on bottom of list, not top

[commit: http://hg.dwscoalition.org/dw-free/rev/20d5107ac17b]

http://bugs.dwscoalition.org/show_bug.cgi?id=605

Make the code be smart about which invite code is auto-selected on this
page.

Patch by [personal profile] afuna.

Files modified:
  • htdocs/manage/circle/invite.bml
--------------------------------------------------------------------------------
diff -r e7e3d648ab7d -r 20d5107ac17b htdocs/manage/circle/invite.bml
--- a/htdocs/manage/circle/invite.bml	Sun Apr 05 02:02:56 2009 +0000
+++ b/htdocs/manage/circle/invite.bml	Sun Apr 05 02:11:31 2009 +0000
@@ -206,6 +206,7 @@
     if ( $LJ::USE_ACCT_CODES ) {
         $body .= "<br />" . LJ::labelfy("code-".$invitecodes[0]->code, $ML{'.form.input.code'});
 
+        my $is_first = 1;
         foreach my $invitecode ( splice( @invitecodes, 0, 5 ) ) {
         
             my $label = $invitecode->code;
@@ -220,7 +221,7 @@
             
             $body .= "<p>";
             $body .= LJ::html_check( { 
-                    selected => $invitecode eq $invitecodes[0] ? 1 : 0,
+                    selected => $is_first,
                     name => "code", 
                     id => "code-".$invitecode->code, 
                     type=> "radio", 
@@ -228,6 +229,7 @@
                     label => $label,
             } );
             $body .= "</p>";
+            $is_first = 0 if $invitecode->code ne $POST{code};
         }
     }
     
--------------------------------------------------------------------------------