Committer: amyshkin
LJSUP-13403: Implement new ESN notification "Somebody promote entry in my journal" for Journal Promo Service usersU trunk/cgi-bin/LJ/Hooks/ESN.pm
Modified: trunk/cgi-bin/LJ/Hooks/ESN.pm =================================================================== --- trunk/cgi-bin/LJ/Hooks/ESN.pm 2012-09-07 13:30:55 UTC (rev 12626) +++ trunk/cgi-bin/LJ/Hooks/ESN.pm 2012-09-10 07:40:10 UTC (rev 12627) @@ -11,7 +11,10 @@ use LJ::Pay::PromotionSlot qw(:regions :classes); use LJ::Pay::Promotion::Notifications; use LJ::Pay::NotificationPromo; +use LJ::Pay::PromotionSlot::Journal; +use LJ::Pay::JournalPromo; + LJ::register_hook('esn_send_email', sub { my ($self, $opts, $ev) = @_; my $u = $self->u; @@ -308,7 +311,6 @@ my $remote = LJ::get_remote(); if ($remote->is_identity) { - return [ 'SupOfficialPost', 'OfficialPost', @@ -319,9 +321,13 @@ 'UserMessageRecvd-u', 'GiveFeatures', ]; + } + else { + my $jslot = LJ::Pay::PromotionSlot->find_slot( + 'class' => PROMO_JOURNAL, + 'userid' => $remote->id, + ); - } else { - return [ 'SupOfficialPost', 'OfficialPost', @@ -334,8 +340,8 @@ 'UserMessageRecvd-u', (LJ::is_enabled('wishlist_v2') && LJ::SUP->is_sup_enabled($remote) ? ('WishList', 'WishListExpire') : ()), 'GiveFeatures', - (LJ::is_enabled('journalpromo') ? ('JournalPromo-u') : ()), - ]; + ( $jslot && $jslot->is_enabled ? ('JournalPromo-u') : ()), + ]; } });