sunnyman's (sunnyman) wrote in changelog,
sunnyman's
sunnyman
changelog

[ljcom] r12208: LJSUP-12388: Implement notifications sub...

Committer: vtroitsky
LJSUP-12388: Implement notifications subsystem
U   trunk/bin/upgrading/en_LJ.dat
U   trunk/cgi-bin/LJ/Pay/SelfPromo.pm
Modified: trunk/bin/upgrading/en_LJ.dat
===================================================================
--- trunk/bin/upgrading/en_LJ.dat	2012-07-03 07:33:17 UTC (rev 12207)
+++ trunk/bin/upgrading/en_LJ.dat	2012-07-03 07:48:11 UTC (rev 12208)
@@ -7896,6 +7896,20 @@
 
 selfpromo.entry.notification.deactivate.ineligible.poster_invisible.subject=Entry promotion discontinued
 
+selfpromo.entry.notification.deactivate.ineligible.same_in_commercial.body<<
+Dear [[user]],
+
+The entry [[object_url]] is withdrawn from commercial promo slot due to it disposition in commercial promo slot. 
+
+Thank you for using the service!
+
+LiveJournal Team
+http://www.livejournal.com
+.
+
+selfpromo.entry.notification.deactivate.ineligible.same_in_commercial.subject=Withdrawl of the entry from selfpromo slot
+
+
 selfpromo.entry.notification.deactivate.owner.body<<
 Dear [[user]],
 

Modified: trunk/cgi-bin/LJ/Pay/SelfPromo.pm
===================================================================
--- trunk/cgi-bin/LJ/Pay/SelfPromo.pm	2012-07-03 07:33:17 UTC (rev 12207)
+++ trunk/cgi-bin/LJ/Pay/SelfPromo.pm	2012-07-03 07:48:11 UTC (rev 12208)
@@ -754,7 +754,7 @@
 # Called from worker 
 sub check_current_promotion {
     my ($class, $slot) = @_;
-  
+
     # Acquire lock to exclusive change promotion status
     # TODO: Perform error processing in case we can't acquire the lock during default timeout.
     my $lock = $class->lock($slot);
@@ -840,6 +840,41 @@
             );
         }
     }
+
+    # check against current commercial promotion
+    # TODO: Make it 
+    if ($promotion->type eq PROMO_OBJECT_TYPE_ENTRY()) {
+        my $cslot = LJ::Pay::PromotionSlot->find_slot(class => PROMO_COMMERCIAL, type => PROMO_OBJECT_TYPE_ENTRY());
+        my $cpromoted_object = $cslot->current_promoted_object();
+        my $centry = $cpromoted_object->object();
+        if ($centry && $promoted_object->is_the_same_object($centry)) {
+            $reason = 'same_in_commercial'; 
+            $promotion->deactivate(
+                'reason'  => 'ineligible',
+                'details' => $reason,
+            );
+
+            $class->send_notification(
+                $slot, $promoter, 'deactivate',
+                'reason'    => 'ineligible',
+                'details'   => $reason,
+                'object_url' => $object_url,
+                'duration'  => time - $promotion->start_time,
+            );
+
+            unless ( LJ::u_equals($owner, $promoter) ) {
+                $class->send_notification(
+                    $slot, $owner, 'deactivate',
+                    'reason'    => 'ineligible',
+                    'details'   => $reason,
+                    'object_url' => $object_url,
+                    'duration'  => time - $promotion->start_time,
+                    'notify_owner' => 1,
+                );
+            }
+        }
+    }
+    
 }
 
 ### LOW LEVEL INTERFACE ###

Tags: dat, ljcom, pm, sunnyman, vtroitsky
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