juks (juks) wrote in changelog,
juks
juks
changelog

[livejournal] r18751: LJSUP-8409 We need to exclude Paid and P...

Committer: iaskarov
LJSUP-8409 We need to exclude Paid and Permanent users from opt "Never used Try&buy"
U   trunk/cgi-bin/LJ/SiteMessages.pm
U   trunk/cgi-bin/LJ/Widget/AddSiteMessages.pm
Modified: trunk/cgi-bin/LJ/SiteMessages.pm
===================================================================
--- trunk/cgi-bin/LJ/SiteMessages.pm	2011-03-30 11:21:43 UTC (rev 18750)
+++ trunk/cgi-bin/LJ/SiteMessages.pm	2011-03-30 11:59:15 UTC (rev 18751)
@@ -6,47 +6,52 @@
     Permanent   => {    
                         value       => 1,
                         group       => 0,
+                        selected    => 1,
                         validate    => sub {
                                             my ($u) = @_;
                                             
                                             return $u->in_class('perm');
-                                       }
+                                       },
                     },
     
     Sponsored   => {    
                         value       => 2,
                         group       => 0,
+                        selected    => 1,
                         validate    => sub {
                                             my ($u) = @_;
                                             
                                             return $u->in_class('sponsored');
-                                       }
+                                       },
                     },
                     
     Paid        => {    
                         value       => 4,
                         group       => 0,
+                        selected    => 1,
                         validate    => sub {
                                             my ($u) = @_;
                                             
                                             return $u->get_cap('paid');
-                                       }
+                                       },
                     },
     
     Plus        => {    
                         value       => 8,
                         group       => 0,
+                        selected    => 1,
                         validate    => sub {
                                             my ($u) = @_;
                                             
                                             return $u->in_class('plus') && !$u->get_cap('paid');
-                                       }
+                                       },
                     },
     
     Basic       => {    
                         
                         value       => 16,
                         group       => 0,
+                        selected    => 1,
                         validate    => sub {
                                             my ($u) = @_;
 
@@ -57,6 +62,7 @@
     SUP         => {    
                         value       => 32,
                         group       => 1,
+                        selected    => 1,
                         validate    => sub {
                                             my ($u) = @_;
                                             
@@ -67,6 +73,7 @@
     NonSUP      => {    
                         value       => 64,
                         group       => 1,
+                        selected    => 1,
                         validate    => sub {
                                             my ($u) = @_;
                                             
@@ -94,6 +101,7 @@
     TryNBuy     => {    
                         value       => 256,
                         group       => 3,
+                        selected    => 1,
                         validate    => sub {
                                             my ($u) = @_;
 
@@ -104,6 +112,7 @@
     AlreadyTryNBuy => { 
                         value       => 512,
                         group       => 3,
+                        selected    => 1,
                         validate    => sub {
                                             my ($u) = @_;
 
@@ -114,6 +123,7 @@
     NeverTryNBuy   => { 
                         value       => 1024,
                         group       => 3,
+                        selected    => 1,
                         validate    => sub {
                                             my ($u) = @_;
 
@@ -142,6 +152,19 @@
 }
 
 #
+#   Get default selected masks bits together
+#
+sub get_default_masks_value {
+    my $result = 0;
+     
+    for my $name (keys %{&AccountMask}) {
+        $result += AccountMask->{$name}->{value} if ( AccountMask->{$name}->{selected});    
+    }
+    
+    return $result;
+}
+
+#
 #   Get mask group number
 #
 sub get_group {

Modified: trunk/cgi-bin/LJ/Widget/AddSiteMessages.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/AddSiteMessages.pm	2011-03-30 11:21:43 UTC (rev 18750)
+++ trunk/cgi-bin/LJ/Widget/AddSiteMessages.pm	2011-03-30 11:59:15 UTC (rev 18751)
@@ -38,11 +38,7 @@
         $end_hour = $end_date->hour;
         $end_min = $end_date->minute;
     } else { # default
-        $accounts =   LJ::SiteMessages::AccountMask->{SUP}->{value}
-                    + LJ::SiteMessages::AccountMask->{NonSUP}->{value}
-                    + LJ::SiteMessages::AccountMask->{NeverTryNBuy}->{value}
-                    + LJ::SiteMessages::AccountMask->{AlreadyTryNBuy}->{value}
-                    + LJ::SiteMessages::AccountMask->{TryNBuy}->{value};
+        $accounts = LJ::SiteMessages->get_default_masks_value();
     }
 
     # default values for year/month/day = today's date

Tags: juks, livejournal, 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