madeon (madeon) wrote in changelog,
madeon
madeon
changelog

[ljcom] r11269: LJSV-1959: Need property for crosspost i...

Committer: sbelyaev
LJSV-1959: Need property for crosspost info
U   trunk/cgi-bin/LJ/Worker/Repost/EntryToFacebook.pm
U   trunk/cgi-bin/LJ/Worker/Repost/EntryToTwitter.pm
Modified: trunk/cgi-bin/LJ/Worker/Repost/EntryToFacebook.pm
===================================================================
--- trunk/cgi-bin/LJ/Worker/Repost/EntryToFacebook.pm	2011-12-19 07:51:16 UTC (rev 11268)
+++ trunk/cgi-bin/LJ/Worker/Repost/EntryToFacebook.pm	2011-12-19 09:18:21 UTC (rev 11269)
@@ -101,7 +101,7 @@
     if ($retdata) {
         my $content = $retdata->decoded_content or '';
         eval {
-            __process_return_data( $poster, $content );
+            __process_return_data( $entry, $poster, $content );
         };
     }
 
@@ -109,15 +109,22 @@
 }
 
 sub __process_return_data {
-    my ($poster, $content) = @_;
+    my ($entry, $poster, $content) = @_;
 
     my $decoded = from_json($content);
     my $error = $decoded->{'error'};
 
     if ( $error ) {
-        __log_statushistory( $poster, $error->{'message'} );
-        __send_error( $poster, $error->{'message'} );
+        my $type       = $error->{'type'};
+        my $error_text = $error->{'message'};
+
+        __log_statushistory( $poster, $error_text );
+        __send_error( $poster, $error_text );
         __destroy_link($poster);
+        $entry->set_prop('crosspost_fb' => "fail");
+    } else {
+        my ($uid, $postid) = split(/_/, $decoded->{'id'} );
+        $entry->set_prop('crosspost_fb' => "http://www.facebook.com/$uid/posts/$postid");
     }
     return;
 }

Modified: trunk/cgi-bin/LJ/Worker/Repost/EntryToTwitter.pm
===================================================================
--- trunk/cgi-bin/LJ/Worker/Repost/EntryToTwitter.pm	2011-12-19 07:51:16 UTC (rev 11268)
+++ trunk/cgi-bin/LJ/Worker/Repost/EntryToTwitter.pm	2011-12-19 09:18:21 UTC (rev 11269)
@@ -47,6 +47,7 @@
         'params' => { 'status' => $status },
     );
 
+    $entry->set_prop('crosspost_tw' => $status );
     return $job->completed;
 }
 

Tags: ljcom, 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