madeon (madeon) wrote in changelog,
madeon
madeon
changelog

[livejournal] r21591: LJSUP-11682: asxml does't work in poll

Committer: sbelyaev
LJSUP-11682: asxml does't work in poll
U   trunk/cgi-bin/ljprotocol.pl
Modified: trunk/cgi-bin/ljprotocol.pl
===================================================================
--- trunk/cgi-bin/ljprotocol.pl	2012-03-29 12:57:41 UTC (rev 21590)
+++ trunk/cgi-bin/ljprotocol.pl	2012-03-29 12:58:51 UTC (rev 21591)
@@ -346,6 +346,18 @@
     @questions = grep { $_->pollqid eq $pollqid } @questions if ($pollqid);
     return fail($err, 203, 'pollqid') unless(@questions);
 
+    if ($req->{'asxml'}) {
+        my $tidy = LJ::Tidy->new();
+
+        foreach my $question (@questions) {
+            if ($question->{text}) {
+                $question->{text} = $tidy->clean( $question->{text} );
+            }
+        }
+        $res->{'name'} = $tidy->clean( $res->{'name'} );
+    }
+
+
     # mode to show poll questions
     if($mode =~ /enter|all/) {
         # render_enter
@@ -373,14 +385,11 @@
                                     $_;
                                 } map { delete $_->{pollqid}; $_ } $question->answers;
 
-            if ($req->{'asxml'} && $question->{text}) {
-                my $tidy = LJ::Tidy->new();
-                $question->{text} = $tidy->clean( $question->{text} );
-            }
-
             @{$res->{answers}{$question->pollqid}} = @answers;
         }
     }
+
+
     return $res;
 }
 

Tags: livejournal, madeon, pl, sbelyaev
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