Committer: ssafronova
LJSUP-4260: anonymous user is allowed to send vgift to user, disabled receiving of all vgiftsU trunk/cgi-bin/LJ/Pay/ShopVGift.pm
Modified: trunk/cgi-bin/LJ/Pay/ShopVGift.pm =================================================================== --- trunk/cgi-bin/LJ/Pay/ShopVGift.pm 2009-04-22 07:09:07 UTC (rev 7225) +++ trunk/cgi-bin/LJ/Pay/ShopVGift.pm 2009-04-23 04:23:15 UTC (rev 7226) @@ -143,16 +143,6 @@ if ($new_vg->is_sponsored && (!$u || $additem->{'anon'})); } - return unless $u; - - unless ($u->rate_check('freevgifts', $spon_ct)) { - if ($additem) { - push @errs, LJ::Lang::ml('ljcom.userInfo.optionlinks.sendvgift.title.sponsored'); - } else { - push @errs, LJ::Lang::ml('ljcom.userInfo.optionlinks.sendvgift.title.too_many_sponsored'); - } - } - my $rcpt_disable_vgifts = LJ::run_hook('opt_disable_vgifts_value', $rcptuser); # check to see if the recipient has: @@ -160,7 +150,7 @@ # - disabled all vgifts # - disabled sponsored vgifts if ($new_vg) { - if ($rcptuser->has_banned($u) || $rcpt_disable_vgifts eq "all") { + if ($u && $rcptuser->has_banned($u) || $rcpt_disable_vgifts eq "all") { push @errs, LJ::Lang::ml( 'ljcom.userinfo.optionlinks.sendvgift.title.' . @@ -175,6 +165,16 @@ } } + return @errs unless $u; + + unless ($u->rate_check('freevgifts', $spon_ct)) { + if ($additem) { + push @errs, LJ::Lang::ml('ljcom.userInfo.optionlinks.sendvgift.title.sponsored'); + } else { + push @errs, LJ::Lang::ml('ljcom.userInfo.optionlinks.sendvgift.title.too_many_sponsored'); + } + } + return @errs; }