sunnyman's (sunnyman) wrote in changelog,
sunnyman's
sunnyman
changelog

[livejournal] r20086: LJSUP-9716: Extended information for use...

Committer: vtroitsky
LJSUP-9716: Extended information for users who left his vote in the poll returned in detaled poll results.
U   trunk/cgi-bin/ljprotocol.pl
Modified: trunk/cgi-bin/ljprotocol.pl
===================================================================
--- trunk/cgi-bin/ljprotocol.pl	2011-09-20 07:23:18 UTC (rev 20085)
+++ trunk/cgi-bin/ljprotocol.pl	2011-09-20 08:41:07 UTC (rev 20086)
@@ -335,7 +335,19 @@
 
     if($mode =~ /answers|all/ && $poll->can_view($u)) {
         foreach my $question (@questions) {
-            my @answers = map { delete $_->{pollqid}; $_ } $question->answers;
+            my @answers = map {     my $user = LJ::load_userid($_->{userid});
+                                    if ($user) {
+                                        $_->{'username'} = $user->username;
+                                        if ($user->identity) {
+                                            my $i = $user->identity;
+                                            $_->{'identity_type'}    = $i->pretty_type;
+                                            $_->{'identity_value'}   = $i->value;
+                                            $_->{'identity_url'}     = $i->url($user);
+                                            $_->{'identity_display'} = $user->display_name;
+                                        }
+                                    }
+                                    $_;
+                                } map { delete $_->{pollqid}; $_ } $question->answers;
             @{$res->{answers}{$question->pollqid}} = @answers;
         }
     }

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