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

[ljcom] r9447: LJSUP-6680. Disable "custom userheads" f...

Committer: gprochaev
LJSUP-6680. Disable "custom userheads" feature for nonSUP users

U   trunk/bin/upgrading/en_LJ.dat
U   trunk/cgi-bin/LJ/Widget/Shop/LeftMenu.pm
U   trunk/cgi-bin/LJ/Widget/Shop/View/UserHeads.pm
Modified: trunk/bin/upgrading/en_LJ.dat
===================================================================
--- trunk/bin/upgrading/en_LJ.dat	2010-08-31 03:49:03 UTC (rev 9446)
+++ trunk/bin/upgrading/en_LJ.dat	2010-08-31 06:38:40 UTC (rev 9447)
@@ -5234,6 +5234,8 @@
 
 shop.error.userhead.not_personal=You can not buy custom userheads for communities.
 
+shop.error.userhead.non-sup.disabled=You can not gift custom userhead for non-sup users.
+
 shop.error.global.cannot_load_cart=Cannot load cart
 
 shop.error.global.not_your_cart=You are trying to view someone other's cart, and you can't do that. Try <a href="/shop/?cart=new">creating a new one</a>.

Modified: trunk/cgi-bin/LJ/Widget/Shop/LeftMenu.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/Shop/LeftMenu.pm	2010-08-31 03:49:03 UTC (rev 9446)
+++ trunk/cgi-bin/LJ/Widget/Shop/LeftMenu.pm	2010-08-31 06:38:40 UTC (rev 9447)
@@ -25,12 +25,20 @@
             url => '/shop/tokens.bml',
             is_selected => $subpage eq 'wallet' ? 1 : 0,
         },
+    ];
+
+    unless (!$is_remote_sup && $LJ::DISABLED{'userhead_nonsup'}) {
+        push @$paid_services, (
+            {
+                name => BML::ml('.storefront.addons.userheads'),
+                url => '/shop/userheads.bml',
+                is_selected => $subpage eq 'userhead' ? 1 : 0,
+            },
+        );
+    }
+
+    push @$paid_services, (
         {
-            name => BML::ml('.storefront.addons.userheads'),
-            url => '/shop/userheads.bml',
-            is_selected => $subpage eq 'userhead' ? 1 : 0,
-        },
-        {
             name => BML::ml('.storefront.addons.extrauserpics'),
             url => '/shop/userpics.bml',
             is_selected => $subpage eq 'userpics' ? 1 : 0,
@@ -45,7 +53,7 @@
             url => '/shop/renameaccount.bml',
             is_selected => $subpage eq 'renameaccount' ? 1 : 0,
         },
-    ];
+    );
 
     my %top_map = (
         paidaccount => 0,

Modified: trunk/cgi-bin/LJ/Widget/Shop/View/UserHeads.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/Shop/View/UserHeads.pm	2010-08-31 03:49:03 UTC (rev 9446)
+++ trunk/cgi-bin/LJ/Widget/Shop/View/UserHeads.pm	2010-08-31 06:38:40 UTC (rev 9447)
@@ -42,6 +42,10 @@
     my ($self) = @_;
 
     my $remote = LJ::get_remote();
+    my $is_remote_sup = LJ::SUP->is_remote_sup();
+    return LJ::Request->redirect("/shop/")
+        if !$is_remote_sup && $LJ::DISABLED{'userhead_nonsup'};
+
     my $gift = ((!$remote || LJ::Request->get_param('gift'))) || 0;
     my $recipient = $gift ? LJ::load_user(LJ::Request->get_param('giftto')) : undef;
     if ($recipient && !$recipient->is_person) {
@@ -49,6 +53,11 @@
         $self->push_error (LJ::Lang::ml('shop.error.userhead.not_personal'));
     }
 
+    if ($LJ::DISABLED{'userhead_nonsup'} && $recipient && !LJ::SUP->is_sup_enabled($recipient)) {
+        $recipient = undef;
+        $self->push_error (LJ::Lang::ml('shop.error.userhead.non-sup.disabled'));
+    }
+
     my ($sec, $min, $hour, $mday, $mon, $year) = localtime(time);
 
     # autocomplete To field on Add form

Tags: dat, 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