Alexander Nazarov (nfokz) wrote in changelog,
Alexander Nazarov
nfokz
changelog

[ljcom] r11142: LJSUP-9901: Add ability to put entry fro...

Committer: anazarov
LJSUP-9901: Add ability to put entry from community to owner and maintainers
U   trunk/cgi-bin/LJ/Pay/Payment/PayItem/SelfPromo.pm
U   trunk/cgi-bin/LJ/Pay/SelfPromo.pm
Modified: trunk/cgi-bin/LJ/Pay/Payment/PayItem/SelfPromo.pm
===================================================================
--- trunk/cgi-bin/LJ/Pay/Payment/PayItem/SelfPromo.pm	2011-11-02 12:26:06 UTC (rev 11141)
+++ trunk/cgi-bin/LJ/Pay/Payment/PayItem/SelfPromo.pm	2011-11-02 15:03:23 UTC (rev 11142)
@@ -163,12 +163,32 @@
 
     if ( $type eq 'buyout' ) {
         my $entry = $self->get_entry;
+        my $poster = $entry->poster;
 
         my $cost = $self->get_amt * LJ::Pay::Wallet::EXCHANGE_RATE();
-        LJ::Pay::SelfPromo->activate_entry( $entry, $cost, $buyer_u );
+        LJ::Pay::SelfPromo->activate_entry( $entry, $cost, $rcpt_u );
 
         $email_subject = $ml->('selfpromo.notification.activate.subject');
 
+        # Need to send second email if entry poster and recipient are different
+        unless ( LJ::u_equals($poster, $rcpt_u) ) {
+            $email_body = $ml->(
+                'selfpromo.notification.activate.body',
+                {   'poster'    => $poster->display_name,
+                    'entry_url' => $entry->url,
+                },
+            );
+
+            LJ::send_mail(
+                {   'to'       => $poster->email_raw,
+                    'from'     => $LJ::DONOTREPLY_EMAIL,
+                    'fromname' => $LJ::SITENAME,
+                    'subject'  => $email_subject,
+                    'body'     => $email_body,
+                }
+            );
+        }
+
         $email_body = $ml->(
             'selfpromo.notification.activate.body',
             {   'poster'    => $rcpt_u->display_name,

Modified: trunk/cgi-bin/LJ/Pay/SelfPromo.pm
===================================================================
--- trunk/cgi-bin/LJ/Pay/SelfPromo.pm	2011-11-02 12:26:06 UTC (rev 11141)
+++ trunk/cgi-bin/LJ/Pay/SelfPromo.pm	2011-11-02 15:03:23 UTC (rev 11142)
@@ -549,7 +549,7 @@
     $class->clear_memcache;
 
     $class->log(
-        $entry->poster,
+        $promoter,
         'entry_url' => $entry->url,
         'event' => 'activate',
     );
@@ -780,7 +780,7 @@
 
 # supported opts: entry_url, event, reason, details
 sub log {
-    my ( $class, $poster, %opts ) = @_;
+    my ( $class, $promoter, %opts ) = @_;
 
     my $message = '';
 
@@ -795,7 +795,7 @@
     }
 
     my $systemu = LJ::load_user('system');
-    return LJ::statushistory_add( $poster, $systemu, 'selfpromo', $message );
+    return LJ::statushistory_add( $promoter, $systemu, 'selfpromo', $message );
 }
 
 package LJ::Pay::SelfPromo::Promo;

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