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

[livejournal] r22675: LJSUP-13323: Fix empty selfpromo params ...

Committer: nnikulochkina
LJSUP-13323: Fix empty selfpromo params in XML-RPC get*ratings functions
U   trunk/cgi-bin/ljprotocol.pl
Modified: trunk/cgi-bin/ljprotocol.pl
===================================================================
--- trunk/cgi-bin/ljprotocol.pl	2012-08-16 12:12:29 UTC (rev 22674)
+++ trunk/cgi-bin/ljprotocol.pl	2012-08-16 12:19:47 UTC (rev 22675)
@@ -5677,6 +5677,7 @@
         LJ::get_aggregated_entry($row, $entry_opts);
 
         $row->{userid} = delete $row->{journalid} if  $row->{journalid};
+
         LJ::get_aggregated_user($row, $user_opts);
 
         push @events, {
@@ -5695,27 +5696,28 @@
         } 
     }
 
-    if ($req->{getselfpromo}) {
-        return fail($err, 500) unless $res->{selfpromo} && ref $res->{selfpromo};
-        my $sp = $res->{selfpromo}->get_template_params();
-        $sp->{ditemid}   = delete $sp->{post_id} if $sp->{post_id};
-        $sp->{journalid} = delete $sp->{journal_id} if $sp->{journal_id};
-        LJ::get_aggregated_entry($sp, $entry_opts);
+    if (my $sp = $res->{selfpromo} && $res->{selfpromo}->get_template_params ) {
 
+        my $obj = $sp->{object}->[0];
+        
+        $obj->{ditemid}   = delete $obj->{post_id} if $obj->{post_id};
+        $obj->{journalid} = delete $obj->{journal_id} if $obj->{journal_id};
+        LJ::get_aggregated_entry($obj, $entry_opts);
+        
         $selfpromo = {
             # selfpromo data
-            remaning_time => $sp->{timeleft}, 
-            price         => $sp->{buyout},
+            remaning_time => $obj->{timeleft},
+            price         => $obj->{buyout},
             # entry data
-            ditemid       => $sp->{ditemid},
-            subject       => $sp->{subject_raw},
-            event         => $sp->{event_raw},
+            ditemid       => $obj->{ditemid},
+            subject       => $obj->{subject_raw},
+            event         => $obj->{event_raw},
             # user data
-            posterid      => $sp->{journal_id},
-            poster        => $sp->{username},
+            posterid      => $obj->{journalid},
+            poster        => $obj->{username},
         };
     }
-    
+
     return {
         status => 'OK',
         skip   => $req->{skip} || 0,

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