wisest owl (wisest_owl) wrote in changelog,
wisest owl
wisest_owl
changelog

[ljcom] r9468: LJSUP-6717. SUP-only vgifts showing to n...

Committer: gprochaev
LJSUP-6717. SUP-only vgifts showing to non-SUP users

U   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,

Tags: ljcom, pm, wisest-owl
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