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

[ljcom] r10679: LJINT-426 (Comments for side projects: c...

Committer: ailyin
LJINT-426 (Comments for side projects: crossposting)
U   trunk/cgi-bin/LJ/Worker/Repost/CommentToFacebook.pm
U   trunk/cgi-bin/LJ/Worker/Repost/CommentToTwitter.pm
U   trunk/cgi-bin/LJ/Worker/Repost/CommentToVkontakte.pm
Modified: trunk/cgi-bin/LJ/Worker/Repost/CommentToFacebook.pm
===================================================================
--- trunk/cgi-bin/LJ/Worker/Repost/CommentToFacebook.pm	2011-06-22 07:45:54 UTC (rev 10678)
+++ trunk/cgi-bin/LJ/Worker/Repost/CommentToFacebook.pm	2011-06-22 07:52:50 UTC (rev 10679)
@@ -11,6 +11,8 @@
 use strict;
 
 use base qw(LJ::Worker::Repost);
+
+use LJ::PartnerSite;
 use LJ::Text;
 
 sub work {
@@ -22,9 +24,20 @@
     my $journal = LJ::load_userid($arg->{'journalid'});
     my $comment = LJ::Comment->new($journal, 'jtalkid' => $arg->{'jtalkid'});
 
+    my $comment_url = $comment->url;
+
+    if ( my $partner =
+        LJ::PartnerSite->find_by_journal_username( $journal->username ) )
+    {
+        my $entry = $comment->entry;
+        $comment_url =
+          $partner->article_link_from_entry( $entry,
+            { 'thread' => $comment->dtalkid } );
+    }
+
     my $data    = {
         'access_token' => $poster->prop('facebook_access_token'),
-        'link' => $comment->url,
+        'link' => $comment_url,
     };
 
     $data->{'message'} = LJ::Lang::get_text(
@@ -33,7 +46,7 @@
         undef,
         {
             'journal' => $journal->display_name,
-            'url' => $comment->url,
+            'url' => $comment_url,
         },
     );
 

Modified: trunk/cgi-bin/LJ/Worker/Repost/CommentToTwitter.pm
===================================================================
--- trunk/cgi-bin/LJ/Worker/Repost/CommentToTwitter.pm	2011-06-22 07:45:54 UTC (rev 10678)
+++ trunk/cgi-bin/LJ/Worker/Repost/CommentToTwitter.pm	2011-06-22 07:52:50 UTC (rev 10679)
@@ -2,8 +2,10 @@
 use strict;
 
 use base qw(LJ::Worker::Repost);
+
+use LJ::Client::Twitter;
+use LJ::PartnerSite;
 use LJ::Text;
-use LJ::Client::Twitter;
 
 sub work {
     my ($class, $job) = @_;
@@ -14,7 +16,18 @@
     my $journal = LJ::load_userid($arg->{'journalid'});
     my $comment = LJ::Comment->new($journal, 'jtalkid' => $arg->{'jtalkid'});
 
-    my $short_url = $class->shorten_url($comment->url);
+    my $comment_url = $comment->url;
+
+    if ( my $partner =
+        LJ::PartnerSite->find_by_journal_username( $journal->username ) )
+    {
+        my $entry = $comment->entry;
+        $comment_url =
+          $partner->article_link_from_entry( $entry,
+            { 'thread' => $comment->dtalkid } );
+    }
+
+    my $short_url = $class->shorten_url($comment_url);
     my $title     = $comment->subject_raw || $comment->body_raw;
 
     $title = $class->cleanup($title);

Modified: trunk/cgi-bin/LJ/Worker/Repost/CommentToVkontakte.pm
===================================================================
--- trunk/cgi-bin/LJ/Worker/Repost/CommentToVkontakte.pm	2011-06-22 07:45:54 UTC (rev 10678)
+++ trunk/cgi-bin/LJ/Worker/Repost/CommentToVkontakte.pm	2011-06-22 07:52:50 UTC (rev 10679)
@@ -2,8 +2,10 @@
 use strict;
 
 use base qw(LJ::Worker::Repost);
+
+use LJ::Client::Vkontakte;
+use LJ::PartnerSite;
 use LJ::Text;
-use LJ::Client::Vkontakte;
 
 sub work {
     my ($class, $job) = @_;
@@ -14,7 +16,18 @@
     my $journal = LJ::load_userid($arg->{'journalid'});
     my $comment = LJ::Comment->new($journal, 'jtalkid' => $arg->{'jtalkid'});
 
-    my $short_url = $class->shorten_url($comment->url);
+    my $comment_url = $comment->url;
+
+    if ( my $partner =
+        LJ::PartnerSite->find_by_journal_username( $journal->username ) )
+    {
+        my $entry = $comment->entry;
+        $comment_url =
+          $partner->article_link_from_entry( $entry,
+            { 'thread' => $comment->dtalkid } );
+    }
+
+    my $short_url = $class->shorten_url($comment_url);
     my $title     = $comment->subject_raw || $comment->body_raw;
 
     $title = $class->cleanup($title);

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