Андрей (andy) wrote in changelog,
Андрей
andy
changelog

[ljcom] r9485: LJSUP-6573 (Add ability to select pictur...

Committer: ailyin
LJSUP-6573 (Add ability to select pictures for Facebook publishing)
U   trunk/cgi-bin/LJ/Worker/Repost/CommentToFacebook.pm
U   trunk/cgi-bin/LJ/Worker/Repost/EntryToFacebook.pm
Modified: trunk/cgi-bin/LJ/Worker/Repost/CommentToFacebook.pm
===================================================================
--- trunk/cgi-bin/LJ/Worker/Repost/CommentToFacebook.pm	2010-09-10 07:46:49 UTC (rev 9484)
+++ trunk/cgi-bin/LJ/Worker/Repost/CommentToFacebook.pm	2010-09-10 08:22:23 UTC (rev 9485)
@@ -42,6 +42,20 @@
     my $picture = $arg->{'thumbnail'}
                || $class->extract_first_picture_url($body_raw);
 
+    # a couple special cases here:
+    # if user chooses not to show images, field will return "nothumb" value.
+    # if user chooses his userpic, field will return "userpic" value.
+    if ($picture eq 'nothumb') {
+        $picture = '';
+    } elsif ($picture eq 'userpic') {
+        my $userpic = $comment->userpic;
+        if ($userpic) {
+            $picture = $userpic->url;
+        } else {
+            $picture = '';
+        }
+    }
+
     $data->{'picture'} = $picture || '';
 
     my $title = $class->cleanup($comment->subject_raw);

Modified: trunk/cgi-bin/LJ/Worker/Repost/EntryToFacebook.pm
===================================================================
--- trunk/cgi-bin/LJ/Worker/Repost/EntryToFacebook.pm	2010-09-10 07:46:49 UTC (rev 9484)
+++ trunk/cgi-bin/LJ/Worker/Repost/EntryToFacebook.pm	2010-09-10 08:22:23 UTC (rev 9485)
@@ -42,6 +42,20 @@
     my $picture = $arg->{'thumbnail'}
                || $class->extract_first_picture_url($event_raw);
 
+    # a couple special cases here:
+    # if user chooses not to show images, field will return "nothumb" value.
+    # if user chooses his userpic, field will return "userpic" value.
+    if ($picture eq 'nothumb') {
+        $picture = '';
+    } elsif ($picture eq 'userpic') {
+        my $userpic = $entry->userpic;
+        if ($userpic) {
+            $picture = $userpic->url;
+        } else {
+            $picture = '';
+        }
+    }
+
     $data->{'picture'} = $picture || '';
 
     my $title = $class->cleanup($entry->subject_raw);

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