Committer: nnikulochkina
LJSUP-13920: Disable banners in journal in case it contains Journal PromoU trunk/bin/upgrading/s2layers/core1.s2 U trunk/cgi-bin/LJ/S2.pm
Modified: trunk/bin/upgrading/s2layers/core1.s2 =================================================================== --- trunk/bin/upgrading/s2layers/core1.s2 2012-10-15 10:34:42 UTC (rev 23133) +++ trunk/bin/upgrading/s2layers/core1.s2 2012-10-15 10:39:06 UTC (rev 23134) @@ -636,8 +636,11 @@ function builtin get_alien_post( string url ) : Entry "Returns any public entry from any journal having give_posts_to_alien prop. Recipient must have get_alien_posts prop"; + function builtin viewer_sees_journalpromo() : bool + "Return true if journal promo is not empty."; + function builtin is_journalpromo() : bool - "Return true if journal promo is not empty."; + "Return true if journal promo is not empty and was not shown."; function builtin journalpromo() : string "Returns rendered journal promo."; Modified: trunk/cgi-bin/LJ/S2.pm =================================================================== --- trunk/cgi-bin/LJ/S2.pm 2012-10-15 10:34:42 UTC (rev 23133) +++ trunk/cgi-bin/LJ/S2.pm 2012-10-15 10:39:06 UTC (rev 23134) @@ -2872,6 +2872,8 @@ } sub Entry__viewer_sees_ebox { + return 0 if Page__viewer_sees_journalpromo(@_); + my $args = _get_Entry_ebox_args(@_); return $args ? LJ::should_show_ad($args):0; } @@ -5352,13 +5354,11 @@ $/x; } -sub Page__is_journalpromo { +sub Page__viewer_sees_journalpromo { my ($ctx, $this) = @_; return 0 if $LJ::S2::CURR_PAGE->{'view'} !~ /^recent|tag|entry|day$/; - return 0 if $LJ::REQ_GLOBAL{'journalpromo_showed'}; - my $opts; $opts->{'remote'} = LJ::get_remote(); @@ -5368,12 +5368,19 @@ eval { $ret = "LJ::Widget::JournalPromo"->is_visible(%$opts); }; if ($@) { - warn "Error when Page::is_journalpromo() try to call LJ::Widget::JournalPromo->is_visible() from LJ::S2:\n$@\n"; + warn "Error when Page::viewer_sees_journalpromo() try to call LJ::Widget::JournalPromo->is_visible() from LJ::S2:\n$@\n"; return 0; } return $ret; } +sub Page__is_journalpromo { + + return 0 if $LJ::REQ_GLOBAL{'journalpromo_showed'}; + + return Page__viewer_sees_journalpromo(@_); +} + sub Page__journalpromo { my ($ctx, $this) = @_;