madeon (madeon) wrote in changelog,
madeon
madeon
changelog

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

Committer: sbelyaev
LJSUP-12148: JSON-RPC
U   trunk/cgi-bin/LJ/Entry/Repost.pm
U   trunk/cgi-bin/ljprotocol.pl
Modified: trunk/cgi-bin/LJ/Entry/Repost.pm
===================================================================
--- trunk/cgi-bin/LJ/Entry/Repost.pm	2012-05-14 07:58:23 UTC (rev 21943)
+++ trunk/cgi-bin/LJ/Entry/Repost.pm	2012-05-14 10:33:00 UTC (rev 21944)
@@ -36,12 +36,10 @@
 sub __get_repostid {
     my ($u, $jitemid, $reposterid) = @_;
 
-    warn "__get_repostid";
     my $journalid = $u->userid;
     my $memcache_key = "reposted_itemid:$journalid:$jitemid:$reposterid";
     my ($itemid) = LJ::MemCache::get($memcache_key);
     if ($itemid) {
-        warn $itemid;
         return $itemid;
     }
 
@@ -100,7 +98,6 @@
     my $err = 0;
     my $flags = { 'noauth'             => 1,
                   'use_custom_time'    => 0,
-                  'allow_dupsing_post' => 1,
                   'u'                  => $u };
 
     my %req = ( 'username'    => $u->user,
@@ -160,7 +157,7 @@
 sub get_status {
     my ($class, $u, $entry_obj) = @_;
 
-    my $reposted = __get_repostid( $entry_obj->journal, $entry_obj->jitemid, $u->userid );
+    my $reposted = __get_repostid( $entry_obj->journal, $entry_obj->jitemid, $u->userid ) || 0;
     return  { 'result' => { 
               'count'    =>  __get_count($entry_obj->journal, $entry_obj->jitemid), 
               'reposted' => !!$reposted, },
@@ -215,7 +212,11 @@
     my $repost_itemid = __get_repostid( $entry_obj->journal, $entry_obj->jitemid, $u->userid );
 
     if ($repost_itemid) {
-        LJ::delete_entry($u, $repost_itemid, undef, undef);
+        LJ::set_remote($u);
+        my $result = LJ::API::Event->delete({ itemid => $repost_itemid, journalid => $u->userid} ); 
+        if ($result->{'error'}) { 
+            return $result;
+        }
         __delete_repost_record($entry_obj->journal, $entry_obj->jitemid, $u->userid);
     
         return  { 'result' => { 'delete' => 'OK' } } ;

Modified: trunk/cgi-bin/ljprotocol.pl
===================================================================
--- trunk/cgi-bin/ljprotocol.pl	2012-05-14 07:58:23 UTC (rev 21943)
+++ trunk/cgi-bin/ljprotocol.pl	2012-05-14 10:33:00 UTC (rev 21944)
@@ -2427,7 +2427,6 @@
     my $res = {};
     my $res_done = 0;  # set true by getlock when post was duplicate, or error getting lock
 
-    my $allowdup = $flags->{'allow_dupsing_post'};
     my $getlock = sub {
         my $delayed = @_;
         my $r = $dbcm->selectrow_array("SELECT GET_LOCK(?, 2)", undef, $lock_key);
@@ -2441,7 +2440,7 @@
         LJ::load_user_props($u, { use_master => 1, reload => 1 }, 'dupsig_post');
          
         my @parts = split(/:/, $u->{'dupsig_post'});
-        if ($parts[0] eq $dupsig && !$allowdup) {
+        if ($parts[0] eq $dupsig) {
             # duplicate!  let's make the client think this was just the
             # normal firsit response.
 

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