madeon (madeon) wrote in changelog,
madeon
madeon
changelog

[ljcom] r11004: LJSV-1566: Additional logging.

Committer: sbelyaev
LJSV-1566: Additional logging.
U   trunk/cgi-bin/LJ/Worker/Repost/EntryToFacebook.pm
U   trunk/htdocs/manage/settings/facebook.bml
Modified: trunk/cgi-bin/LJ/Worker/Repost/EntryToFacebook.pm
===================================================================
--- trunk/cgi-bin/LJ/Worker/Repost/EntryToFacebook.pm	2011-09-14 08:41:48 UTC (rev 11003)
+++ trunk/cgi-bin/LJ/Worker/Repost/EntryToFacebook.pm	2011-09-14 09:15:10 UTC (rev 11004)
@@ -101,7 +101,7 @@
     if ($retdata) {
         my $content = $retdata->decoded_content or '';
         eval {
-            __process_return_data( $poster, $content);
+            __process_return_data( $poster, $content );
         };
     }
 
@@ -115,9 +115,9 @@
     my $error = $decoded->{'error'};
 
     if ( $error ) {
+        __log_statushistory( $poster, $error->{'message'} );
         __send_error( $poster, $error->{'message'} );
         __destroy_link($poster);
-        
     }
     return;
 }
@@ -157,15 +157,15 @@
         'body' => $error,
         { subject => $subject, reason => $error },
     });
-
-    return __log_statushistory( $poster, $error );
+    return;
 }
 
 sub __log_statushistory {
-    my ( $poster, $notes ) = @_;
+    my ( $poster, $error ) = @_;
 
     my $sys_uid   = LJ::get_userid("system");
-    return LJ::statushistory_add($poster->userid, $sys_uid, 'facebook_connect', $notes);
+    my $notes = "Disconnected automatically. Facebook return the following error: $error";
+    LJ::statushistory_add($poster->userid, $sys_uid, 'facebook_connect', $notes);
 }
 
 1;

Modified: trunk/htdocs/manage/settings/facebook.bml
===================================================================
--- trunk/htdocs/manage/settings/facebook.bml	2011-09-14 08:41:48 UTC (rev 11003)
+++ trunk/htdocs/manage/settings/facebook.bml	2011-09-14 09:15:10 UTC (rev 11004)
@@ -84,6 +84,12 @@
         $u->set_prop('facebook_name'         => $fb_userdata->{'name'});
         $u->set_prop('facebook_link'         => $fb_userdata->{'link'});
 
+        my $sys_uid  = LJ::get_userid("system");
+        my $notes = "Connected with " . $fb_userdata->{'link'};
+        LJ::statushistory_add($u->userid, $sys_uid, 'facebook_connect', $notes);
+
+        my $facebook_name = $fb_userdata->{'name'};
+
         return LJ::Request->redirect($settings_page);
     } else {
         # $act eq 'disconnect'
@@ -97,6 +103,10 @@
         $u->clear_prop($_)
             foreach qw( facebook_access_token facebook_name facebook_link );
 
+        my $sys_uid  = LJ::get_userid("system");
+        my $notes = "Disconnected by user.";
+        LJ::statushistory_add($u->userid, $sys_uid, 'facebook_connect', $notes);
+
         return LJ::Request->redirect($settings_page);
     }
 }

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