holyandrew (holyandrew) wrote in changelog,
holyandrew
holyandrew
changelog

[ljcom] r12291: LJSV-2326: Promo notifications are sendi...

Committer: akanashin
LJSV-2326: Promo notifications are sending to non-cyrillic users (community comments)
U   trunk/cgi-bin/LJ/Hooks/ESN.pm
Modified: trunk/cgi-bin/LJ/Hooks/ESN.pm
===================================================================
--- trunk/cgi-bin/LJ/Hooks/ESN.pm	2012-07-16 08:53:48 UTC (rev 12290)
+++ trunk/cgi-bin/LJ/Hooks/ESN.pm	2012-07-16 11:39:30 UTC (rev 12291)
@@ -92,8 +92,15 @@
 
     return unless LJ::Pay::Promotion::Notifications->is_avialable_region($u);
 
-    my $active_region = lc($u->prop('country') || LJ::GeoLocation->get_country_info_by_ip());
+    my $active_region = lc($u->prop('country'));
 
+    unless ($active_region) {
+        my $db = LJ::get_cluster_writer($u);
+        my ($ip) = $db->selectrow_array( "SELECT ip FROM userlog WHERE userid=? AND action='account_create' LIMIT 1", undef, $u->userid);
+        $active_region = LJ::GeoLocation($ip);
+    }
+    return unless $active_region;
+
     my $slot = LJ::Pay::PromotionSlot->find_slot(class => LJ::Pay::PromotionSlot::PROMO_NOTIFICATIONS(), type => LJ::Pay::PromotionSlot::PROMO_OBJECT_TYPE_ENTRY(), region => $active_region);
     return unless $slot;
 

Tags: akanashin, holyandrew, 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