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

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

Committer: vtroitsky
LJSUP-12388: Implement notifications subsystem
U   trunk/cgi-bin/LJ/Pay/SelfPromo.pm
Modified: trunk/cgi-bin/LJ/Pay/SelfPromo.pm
===================================================================
--- trunk/cgi-bin/LJ/Pay/SelfPromo.pm	2012-07-04 11:52:37 UTC (rev 12224)
+++ trunk/cgi-bin/LJ/Pay/SelfPromo.pm	2012-07-04 13:31:15 UTC (rev 12225)
@@ -847,31 +847,33 @@
     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 = 'in_commpromo'; 
-            $promotion->deactivate(
-                'reason'  => 'ineligible',
-                'details' => $reason,
-            );
+        if ($cpromoted_object) {
+            my $centry = $cpromoted_object->object();
+            if ($centry && $promoted_object->is_the_same_object($centry)) {
+                $reason = 'in_commpromo'; 
+                $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',
+                    $slot, $promoter, 'deactivate',
                     'reason'    => 'ineligible',
                     'details'   => $reason,
                     'object_url' => $object_url,
                     'duration'  => time - $promotion->start_time,
-                    'notify_owner' => 1,
                 );
+
+                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,
+                    );
+                }
             }
         }
     }

Tags: 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