madeon (madeon) wrote in changelog,
madeon
madeon
changelog

[livejournal] r21951: LJSUP-12148: JSON-RPC

Committer: sbelyaev
LJSUP-12148: JSON-RPC
U   trunk/cgi-bin/LJ/Entry/Repost.pm
U   trunk/cgi-bin/LJ/JSON/RPC/Item.pm
Modified: trunk/cgi-bin/LJ/Entry/Repost.pm
===================================================================
--- trunk/cgi-bin/LJ/Entry/Repost.pm	2012-05-14 14:40:07 UTC (rev 21950)
+++ trunk/cgi-bin/LJ/Entry/Repost.pm	2012-05-14 14:55:53 UTC (rev 21951)
@@ -252,7 +252,7 @@
             my $count = __get_count($entry_obj->journal, $entry_obj->jitemid);
             $result->{'result'} = { 'count' => $count };
         } elsif (!$error) {
-            $error = LJ::Lang::ml('api.unknown');
+            $error = LJ::Lang::ml('api.error.unknown_error');
         }
     }
 
@@ -268,8 +268,22 @@
     my ($class, $entry_obj, $opts) = @_;
 
     my $original_entry_obj = $entry_obj->original_post;
-    return unless $original_entry_obj;
 
+    unless ($original_entry_obj) {
+        my $link = $entry_obj->prop('repost_link'); 
+        if ($link) {
+            my ($org_journalid, $org_jitemid) = split(/:/, $link);
+            my $journal = int($link) ? LJ::want_user($link) : undef;
+             
+            my $event = LJ::Lang::ml( 'entry.reference.journal.delete',
+                                      'datetime'     => $entry_obj->eventtime_mysql );
+
+            ${$opts->{'event'}} = $event;
+            return 1;    
+        }
+        return 0;
+    }
+
     if ($opts->{'anum'}) {
         ${$opts->{'anum'}} = $original_entry_obj->anum;
     }
@@ -315,7 +329,7 @@
     }
 
     if ($opts->{'eventtime'}) {
-        ${$opts->{'eventtime'}} = $original_entry_obj->eventtime_mysql;
+        ${$opts->{'eventtime'}} = $entry_obj->eventtime_mysql;
     }
 
     if ($opts->{'event'}) {

Modified: trunk/cgi-bin/LJ/JSON/RPC/Item.pm
===================================================================
--- trunk/cgi-bin/LJ/JSON/RPC/Item.pm	2012-05-14 14:40:07 UTC (rev 21950)
+++ trunk/cgi-bin/LJ/JSON/RPC/Item.pm	2012-05-14 14:55:53 UTC (rev 21951)
@@ -56,7 +56,9 @@
     $self->{'uri'}    = $uri;
     $self->{'method'} = $method;
     $self->{'params'} = $params;
-    $self->{'id'}     = $data->{'id'};
+    if (exists $data->{'id'}) {
+        $self->{'id'}     = $data->{'id'};
+    }
  
     return $self,
 }
@@ -173,7 +175,7 @@
 
 sub is_notitification {
     my ($self) = @_;
-    return !$self->{'id'};
+    return !(exists $self->{'id'});
 }
 
 1;

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