madeon (madeon) wrote in changelog,
madeon
madeon
changelog

[livejournal] r20269: LJSUP-10099: If posting failed entry wou...

Committer: sbelyaev
LJSUP-10099: If posting failed entry would be deleted
U   trunk/cgi-bin/LJ/DelayedEntry.pm
Modified: trunk/cgi-bin/LJ/DelayedEntry.pm
===================================================================
--- trunk/cgi-bin/LJ/DelayedEntry.pm	2011-10-11 03:53:02 UTC (rev 20268)
+++ trunk/cgi-bin/LJ/DelayedEntry.pm	2011-10-11 05:15:36 UTC (rev 20269)
@@ -1190,8 +1190,11 @@
                   'u' => $self->poster };
 
     my $err = 0;
-    my $ree = LJ::Protocol::do_request("postevent", $req, \$err, $flags);
-    return { delete_entry => 1, res => $ree };
+    my $res = LJ::Protocol::do_request("postevent", $req, \$err, $flags);
+    my $fail = !defined $res->{itemid} && $res->{message};
+    
+    return { 'delete_entry' => (!$fail || $err < 500), 
+             'res' => $res };
 }
 
 sub convert_from_data {
@@ -1205,7 +1208,8 @@
     if ($fail) {
         $self->update($req);
     }
-    return { delete_entry => !$fail, res => $res };
+    return { 'delete_entry' => (!$fail || $err < 500), 
+             'res' => $res };
 
 }
 

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