[dw-free] prevent purchase of paid time for someone who's banned you
[commit: http://hg.dwscoalition.org/dw-free/rev/638833e5c9de]
http://bugs.dwscoalition.org/show_bug.cgi?id=1042
Disallow purchasing paid time for someone who has banned you from their
account.
Patch by
afuna.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=1042
Disallow purchasing paid time for someone who has banned you from their
account.
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- bin/upgrading/en.dat
- cgi-bin/LJ/Widget/ShopItemOptions.pm
-------------------------------------------------------------------------------- diff -r 54349fec3e1e -r 638833e5c9de bin/upgrading/en.dat --- a/bin/upgrading/en.dat Fri Jun 12 20:54:45 2009 +0000 +++ b/bin/upgrading/en.dat Fri Jun 12 20:59:31 2009 +0000 @@ -4501,6 +4501,8 @@ widget.shopitemgroupdisplay.paidaccounts widget.shopitemgroupdisplay.paidaccounts.item.self=<a [[aopts]]>For yourself</a> ([[user]]) +widget.shopitemoptions.error.banned=You are restricted from making purchases for this journal. + widget.shopitemoptions.error.invalidusername=The username you entered is invalid or the user does not exist. widget.shopitemoptions.error.nocart=Unable to get a shopping cart for you. Please try again later. diff -r 54349fec3e1e -r 638833e5c9de cgi-bin/LJ/Widget/ShopItemOptions.pm --- a/cgi-bin/LJ/Widget/ShopItemOptions.pm Fri Jun 12 20:54:45 2009 +0000 +++ b/cgi-bin/LJ/Widget/ShopItemOptions.pm Fri Jun 12 20:59:31 2009 +0000 @@ -95,11 +95,15 @@ sub handle_post { } } elsif ( $post->{for} eq 'gift' ) { my $target_u = LJ::load_user( $post->{username} ); - if ( LJ::isu( $target_u ) ) { - $item_data{target_userid} = $target_u->id; - } else { - return ( error => $class->ml( 'widget.shopitemoptions.error.invalidusername' ) ); - } + + return ( error => $class->ml( 'widget.shopitemoptions.error.invalidusername' ) ) + unless LJ::isu( $target_u ); + + return ( error => $class->ml( 'widget.shopitemoptions.error.banned' ) ) + if $remote && $target_u->has_banned( $remote ); + + $item_data{target_userid} = $target_u->id; + } elsif ( $post->{for} eq 'new' ) { my @email_errors; LJ::check_email( $post->{email}, \@email_errors ); --------------------------------------------------------------------------------