changelog_bot (changelog_bot) wrote in changelog,
changelog_bot
changelog_bot
changelog

[ljcom] r10335: LJSUP-7533: fixed

Committer: emazin
LJSUP-7533: fixed
U   trunk/cgi-bin/LJ/Hooks/Settings.pm
Modified: trunk/cgi-bin/LJ/Hooks/Settings.pm
===================================================================
--- trunk/cgi-bin/LJ/Hooks/Settings.pm	2011-03-31 09:57:27 UTC (rev 10334)
+++ trunk/cgi-bin/LJ/Hooks/Settings.pm	2011-04-01 03:49:08 UTC (rev 10335)
@@ -21,8 +21,11 @@
 LJ::register_hook('opt_disable_vgifts_value', sub {
     my $u = shift;
 
+    # can user disable sponsored vgifts? LJSUP-7533
+    my $can_disable_sponsored = !($u->in_class('plus') && !$u->get_cap('paid'));
+
     # if the user is paid and hasn't explicitly set the vgift option, disable sponsored vgits for them
-    return ('none', 1) if !$u->prop('opt_disable_vgifts') && $u->in_class('paid');
+    return ('none', 1) if !$u->prop('opt_disable_vgifts') && $can_disable_sponsored;
 
     my ($drop_value, $sponsored) = split /,/, $u->prop('opt_disable_vgifts');
     if ($drop_value eq 'sponsored') {
@@ -30,8 +33,8 @@
         $sponsored = 1;
     }
 
-    # if the user is plus/basic and is disabling sponsored vgifts, make them enable vgifts
-    if (!$u->get_cap('paid') && $sponsored) {
+    # if the user is plus and is disabling sponsored vgifts, make them enable vgifts. LJSUP-7533 - only for plus
+    if (!$can_disable_sponsored && $sponsored) {
         $sponsored = 0;
     }
 
@@ -85,8 +88,8 @@
     my $u = shift;
     my $ret;
 
-    my $sponsored_text = LJ::Lang::ml('ljcom.extra_privacy_options.vgifts.disable.sponsored');
-    $sponsored_text = "$sponsored_text*" unless $u->get_cap('paid');
+    # can user disable sponsored vgifts? LJSUP-7533
+    my $can_disable_sponsored = !($u->in_class('plus') && !$u->get_cap('paid'));
 
     my ($drop_value, $sponsored) = LJ::run_hook('opt_disable_vgifts_value', $u);
 
@@ -104,15 +107,14 @@
     $ret .= LJ::html_check({ 'type' => 'check', 
                              'name' => 'opt_disable_vgifts_sponsored',
                              'id' => 'opt_disable_vgifts_sponsored',
-                             'disabled' => !$u->get_cap('paid'), 
+                             'disabled' => !$can_disable_sponsored, 
                              'selected' => $sponsored });
     $ret .= "<label for='opt_disable_vgifts_sponsored'>" . LJ::Lang::ml('ljcom.extra_privacy_options.vgifts.disable.sponsored') . "</label>";
-    my $not_paid = !$u->get_cap('paid');
     $ret .= qq|<script type="text/javascript">
         jQuery('#opt_disable_vgifts').change(function()
         {
             var disable_sponsored = jQuery('#opt_disable_vgifts_sponsored'),
-                is_plus = '$not_paid';
+                is_plus = '|.!$can_disable_sponsored.qq|';
             if (jQuery(this).val() == 'all') {
                 disable_sponsored.attr('checked', 'checked').attr('disabled', 'disabled');
             } else if (disable_sponsored.attr('disabled')) {
@@ -122,7 +124,7 @@
         })
         .change();
     </script>|;
-    $ret .= "<br /><span class='helper'>*" . LJ::Lang::ml('ljcom.extra_privacy_options.vgifts.disable.note') . "</span>" unless $u->get_cap('paid');
+    $ret .= "<br /><span class='helper'>*" . LJ::Lang::ml('ljcom.extra_privacy_options.vgifts.disable.note') . "</span>" unless $can_disable_sponsored;
     $ret .= "</td></tr>\n";
     $ret .= "</table>\n";
 
@@ -138,7 +140,7 @@
     if (defined $val or defined $sponsored) {
         $val = "none" unless $val eq "none" or $val eq "non-friends" or $val eq "anon" or $val eq "all";
         $sponsored = $sponsored ? 1 : 0;
-        $sponsored = 0 if $u->in_class('plus') && !$u->in_class('paid') && $sponsored;
+        $sponsored = 0 if $u->in_class('plus') && !$u->get_cap('paid') && $sponsored;
 
         $u->set_prop( opt_disable_vgifts => "$val,$sponsored" );
     }

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