Типа я (zilogic) wrote in changelog,
Типа я
zilogic
changelog

[livejournal] r19910: LJSUP-8857: Updating commenting form

Committer: amyshkin
LJSUP-8857: Updating commenting form
U   trunk/cgi-bin/LJ/Talk.pm
U   trunk/htdocs/talkpost_do.bml
Modified: trunk/cgi-bin/LJ/Talk.pm
===================================================================
--- trunk/cgi-bin/LJ/Talk.pm	2011-08-31 07:48:39 UTC (rev 19909)
+++ trunk/cgi-bin/LJ/Talk.pm	2011-08-31 07:58:50 UTC (rev 19910)
@@ -1871,7 +1871,9 @@
     # Display captcha challenge if over rate limits.
     my $captcha_html = '';
 
-    if ( $opts->{do_captcha} ) {
+    # generate captcha_html in any case but show only when needed
+    # TODO: commented code will be cleared after tests
+#    if ( $opts->{do_captcha} ) {
         if ( LJ::is_enabled("recaptcha") ) {
             my $c      = Captcha::reCAPTCHA->new;
             my $apikey = LJ::conf_test( $LJ::RECAPTCHA{public_key} );
@@ -1918,7 +1920,7 @@
             $captcha_html .= LJ::html_text( { name => 'answer', size => 15 } );
             $captcha_html .= LJ::html_hidden( captcha_chal => $captcha_chal );
         }
-    }
+#    }
 
     my $show_logips = $journalu->{'opt_logcommentips'};
     my $ml_logcommentips;
@@ -2007,6 +2009,7 @@
         'is_identity'            => $remote && $remote->is_identity,
         'remote_can_comment'     => $remote_can_comment,
 
+        'need_captcha'              => $opts->{do_captcha},
         'captcha_html'              => $captcha_html,
         'comment_length_cap'        => LJ::CMAX_COMMENT,
         'show_spellcheck'           => $LJ::SPELLER ? 1 : 0,

Modified: trunk/htdocs/talkpost_do.bml
===================================================================
--- trunk/htdocs/talkpost_do.bml	2011-08-31 07:48:39 UTC (rev 19909)
+++ trunk/htdocs/talkpost_do.bml	2011-08-31 07:58:50 UTC (rev 19910)
@@ -5,6 +5,7 @@
 
     our ( %ML, %GET, %POST, $title, $body );
     my ( $status, $result, $answer, $redirected, $user_url );
+    my $need_captcha = 0;
 
     my $restore_old = sub {
         my $remote = LJ::get_remote();
@@ -182,7 +183,6 @@
         }
 
         ## init.  this handles all the error-checking, as well.
-        my $need_captcha = 0;
         my $init = LJ::Talk::Post::init(\%POST, $remote, \$need_captcha, \@errors);
 
         return $error->($errors[-1]) if $ajax && int(@errors);
@@ -392,13 +392,13 @@
                 $mlcode = $POST{'usertype'} eq 'anonymous'
                     ? '.success.screened.comm.anon2'
                     : '.success.screened.comm2';
-                return $redirect->($curl . '&screen=' . LJ::eurl($SC . $mlcode) . '&aopts=' . LJ::eurl("href='$commentlink'") . $cadr) if $ajax;
+                return $redirect->($curl . '&screen=' . LJ::eurl($SC . $mlcode) . $cadr) if $ajax;
             }
             else {
                 $mlcode = $POST{'usertype'} eq 'anonymous'
                     ? '.success.screened.user.anon2'
                     : '.success.screened.user2';
-                return $redirect->($curl . '&screen=' . LJ::eurl($SC . $mlcode) . '&aopts=' . LJ::eurl("href='$commentlink'") . $cadr) if $ajax;
+                return $redirect->($curl . '&screen=' . LJ::eurl($SC . $mlcode) . $cadr) if $ajax;
             }
         }
 
@@ -434,12 +434,15 @@
 
     if ( $ajax ) {
         $result = LJ::eurl($result);
+        my $add = $need_captcha
+            ? '&need_captcha=1'
+            : '';
         return qq~
 <!DOCTYPE html>
 <html>
 <head></head>
 <body>
-<iframe src="$user_url/xdreceiver.html?status=$status&result=$result" />
+<iframe src="$user_url/xdreceiver.html?status=$status&result=$result$add" />
 </body>
 </html>
 ~;

Tags: bml, livejournal, pm, zilogic
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments