Committer: vsukhanov
LJM-1659: provide identity info about comment posterU trunk/cgi-bin/LJ/SUP/RPC/Command/comments_tree.pm
Modified: trunk/cgi-bin/LJ/SUP/RPC/Command/comments_tree.pm =================================================================== --- trunk/cgi-bin/LJ/SUP/RPC/Command/comments_tree.pm 2010-12-15 07:10:01 UTC (rev 9849) +++ trunk/cgi-bin/LJ/SUP/RPC/Command/comments_tree.pm 2010-12-15 11:41:06 UTC (rev 9850) @@ -175,17 +175,31 @@ my $comment = shift; my $text = $comment->{body}; #my $pu = $comment->{posterid} ? $user{$com->{posterid}} : undef; - my $pu = undef; + my $pu = $comment->{upost}; LJ::CleanHTML::clean_comment(\$text, { 'preformatted' => $comment->{'props'}->{'opt_preformatted'}, 'anon_comment' => $comment->{posterid} ? 0 : 1, }); + my $journaltype = $pu->{journaltype}; + + ## Provide identity info + my %ident_info = (); + if (my $ident = $pu->identity){ + $ident_info{typeid} = $ident->typeid; + $ident_info{short_code} = $ident->short_code; + $ident_info{name} = $ident->display_name($pu); + $ident_info{ljuser_display_params} + = $ident->ljuser_display_params($pu); + $ident_info{url} = $ident->url($pu); + } + return { talkid => $comment->{talkid} * 256 + $anum, subject => $comment->{subject}, text => $text, datepost_unix => $comment->{datepost_unix}, - poster => { journal_type => $comment->{upost}->{journaltype}, - username => $comment->{userpost} + poster => { journal_type => $journaltype, + username => $comment->{userpost}, + ($pu->is_identity ? { identity => \%ident_info } : ()), }, posterid => $comment->{posterid}, state => $comment->{state},