[ljcom] r9835: LJSUP-7579: Limit number of vgifts shown...
Committer: ssafronova
LJSUP-7579: Limit number of vgifts shown in profileU trunk/cgi-bin/LJ/VGift.pm
Modified: trunk/cgi-bin/LJ/VGift.pm
===================================================================
--- trunk/cgi-bin/LJ/VGift.pm 2010-12-13 12:13:33 UTC (rev 9834)
+++ trunk/cgi-bin/LJ/VGift.pm 2010-12-13 13:07:23 UTC (rev 9835)
@@ -74,7 +74,7 @@
my $memkey = memkey($u);
my $gifts = LJ::MemCache::get($memkey);
if ($gifts) {
- return expired_filter($gifts) unless ($opts{'showall'});
+ return expired_filter($gifts, $u) unless ($opts{'showall'});
return @$gifts;
}
@@ -89,7 +89,7 @@
}
@gifts = sort { $b->{daterecv} <=> $a->{daterecv} } @gifts;
LJ::MemCache::set($memkey, \@gifts, 3600);
- return expired_filter(\@gifts) unless ($opts{'showall'});
+ return expired_filter(\@gifts, $u) unless ($opts{'showall'});
return @gifts;
}
@@ -103,9 +103,10 @@
## Gifts must be already ordered by daterecv field.
sub expired_filter {
my $gifts = shift;
+ my $u = shift;
return undef unless $gifts;
@$gifts = grep { ! $_->is_removed_from_profile } @$gifts;
- my $limit = 10;
+ my $limit = LJ::SUP->is_sup_enabled($u) ? 6 : 10;
$#$gifts = $limit-1 if @$gifts>$limit;
return @$gifts;
}
