журнал (shhh) wrote in changelog,
журнал
shhh
changelog

[livejournal] r22360: LJSUP-12765: XML-RPC getusersratings: id...

Committer: nnikulochkina
LJSUP-12765: XML-RPC getusersratings: identity_* paramethers
U   trunk/cgi-bin/LJ/User.pm
U   trunk/cgi-bin/ljprotocol.pl
Modified: trunk/cgi-bin/LJ/User.pm
===================================================================
--- trunk/cgi-bin/LJ/User.pm	2012-06-29 14:49:59 UTC (rev 22359)
+++ trunk/cgi-bin/LJ/User.pm	2012-07-02 06:55:38 UTC (rev 22360)
@@ -10903,10 +10903,27 @@
 
     return unless $opts->{attrs} && ref $opts->{attrs};
 
+    my @identity_methods;
+
     foreach my $method (@{$opts->{attrs}}) {
+        if($method =~ /^identity_(.+)/) {
+            push @identity_methods, $1;
+            next;
+        }
+
         my @result = eval {$user->$method};
         ($row->{$method}) = @result > 1 ? \@result : @result;
     }
+
+    return unless (@identity_methods && $user->is_identity);
+
+    my $i = $user->identity;
+
+    foreach my $method (@identity_methods) {
+        my @result = eval {$i->$method};
+        ($row->{'identity_'.$method}) = @result > 1 ? \@result : @result;
+    }
+
 }
 
     

Modified: trunk/cgi-bin/ljprotocol.pl
===================================================================
--- trunk/cgi-bin/ljprotocol.pl	2012-06-29 14:49:59 UTC (rev 22359)
+++ trunk/cgi-bin/ljprotocol.pl	2012-07-02 06:55:38 UTC (rev 22360)
@@ -5567,7 +5567,8 @@
     my (@users, $selfpromo);
 
     my $user_opts = {
-        attrs => [qw(username display_name profile_url journal_base userpic userhead_url name_raw)],
+        attrs => [qw(username display_name profile_url journal_base userpic userhead_url name_raw 
+                     identity_pretty_type identity_value identity_url )],
     };
 
     foreach my $row (@{$res->{data}}) {
@@ -5585,7 +5586,9 @@
             # user data
             username         => $row->{username},
             identity_display => $row->{display_name},
-            identity_url     => $row->{profile_url},
+            identity_url     => $row->{identity_url},
+            identity_type    => $row->{identity_pretty_type},
+            identity_value   => $row->{identity_value},
             userpic_url      => $row->{userpic} ? $row->{userpic}->url : '',
             journal_url      => $row->{journal_base},
             userhead_url     => $row->{userhead_url},
@@ -5596,7 +5599,7 @@
     if ($req->{getselfpromo}) {
         return fail($err, 500) unless $res->{selfpromo} && ref $res->{selfpromo};
       
-        my $sp = $res->{selfpromo}->get_template_params()->[0];
+        my $sp = $res->{selfpromo}->get_template_params();
         $sp->{userid} = delete $sp->{journal_id} if  $sp->{journal_id};
         LJ::get_aggregated_user($sp, $user_opts);
 
@@ -5607,7 +5610,9 @@
             # user data
             username         => $sp->{username},
             identity_display => $sp->{display_name},
-            identity_url     => $sp->{profile_url},
+            identity_url     => $sp->{identity_url},
+            identity_type    => $sp->{identity_pretty_type},
+            identity_value   => $sp->{identity_value},
             userpic_url      => $sp->{userpic} ? $sp->{userpic}->url : '',
             journal_url      => $sp->{journal_base},
             userhead_url     => $sp->{userhead_url},

Tags: livejournal, nikulochkina, nnikulochkina, pl, pm
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