Committer: gprochaev
LJSUP-6717. SUP-only vgifts showing to non-SUP usersU trunk/cgi-bin/LJ/Widget/Shop/View/VGifts.pm
Modified: trunk/cgi-bin/LJ/Widget/Shop/View/VGifts.pm =================================================================== --- trunk/cgi-bin/LJ/Widget/Shop/View/VGifts.pm 2010-09-07 01:59:14 UTC (rev 9467) +++ trunk/cgi-bin/LJ/Widget/Shop/View/VGifts.pm 2010-09-07 07:23:17 UTC (rev 9468) @@ -45,7 +45,22 @@ } } } elsif ($display_cat && $display_cat eq 'all') { - @shown_vgifts = values %all_vgifts; + foreach my $vgift (values %all_vgifts) { + my $cat = $vgift->{'cats'}[0]; + + # hey, we didn't find a cat, which means that this vgift doesn't + # belong to this category at all. let's skip it, then. + next unless $cat; + + # aaaaaand we finally proceed with checking "SUP tries to see + # non-SUP vgift" cases + next if !$is_remote_sup && $cat->{'sup_flag'} eq 'sup'; + next if $is_remote_sup && $cat->{'sup_flag'} eq 'nosup'; + + # phew. everything's in order, let's record that we're showing this one + # to the user. + push @shown_vgifts, $vgift; + } } else { foreach my $vgift (values %all_vgifts) { # similarly, if the vgift is only set to show to SUP (non-SUP) users,