ssafronova (ssafronova) wrote in changelog,
ssafronova
ssafronova
changelog

[livejournal] r18377: LJSUP-7445: Try & buy - LJSUP-7993: don'...

Committer: ssafronova
LJSUP-7445: Try & buy - LJSUP-7993: don't working system message
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-02-22 08:58:35 UTC (rev 18376)
+++ trunk/cgi-bin/LJ/SiteMessages.pm	2011-02-22 09:26:50 UTC (rev 18377)
@@ -12,18 +12,25 @@
     NonSUP      => 64,
     OfficeOnly  => 128,
     TryNBuy     => 256,
+    AlreadyTryNBuy => 512,
+    NeverTryNBuy   => 1024,
 };
 
 sub get_user_class {
     my $class = shift;
     my $u = shift;
 
-    return AccountMask->{Permanent} if $u->in_class('perm');
-    return AccountMask->{Sponsored} if $u->in_class('sponsored');
-    return AccountMask->{TryNBuy} if $u->get_cap('trynbuy');    # TryNBuy should go before Paid
-    return AccountMask->{Paid} if $u->get_cap('paid');
-    return AccountMask->{Plus} if $u->in_class('plus');
-    return AccountMask->{Basic};
+    my $add = 0;
+    my $already_tb = LJ::TryNBuy->already_used($u);
+    $add += AccountMask->{AlreadyTryNBuy} if $already_tb;
+    $add += AccountMask->{NeverTryNBuy} unless $u->get_cap('trynbuy') or $already_tb;
+
+    return $add + AccountMask->{Permanent} if $u->in_class('perm');
+    return $add + AccountMask->{Sponsored} if $u->in_class('sponsored');
+    return $add + AccountMask->{TryNBuy} if $u->get_cap('trynbuy');    # TryNBuy should go before Paid
+    return $add + AccountMask->{Paid} if $u->get_cap('paid');
+    return $add + AccountMask->{Plus} if $u->in_class('plus');
+    return $add + AccountMask->{Basic};
 }
 
 sub get_class_string {

Modified: trunk/cgi-bin/LJ/Widget/AddSiteMessages.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/AddSiteMessages.pm	2011-02-22 08:58:35 UTC (rev 18376)
+++ trunk/cgi-bin/LJ/Widget/AddSiteMessages.pm	2011-02-22 09:26:50 UTC (rev 18377)
@@ -37,6 +37,9 @@
         $end_year = $end_date->year;
         $end_hour = $end_date->hour;
         $end_min = $end_date->minute;
+    } else { # default
+        $accounts = LJ::SiteMessages::AccountMask->{SUP} + LJ::SiteMessages::AccountMask->{NonSUP}
+                  + LJ::SiteMessages::AccountMask->{NeverTryNBuy} + LJ::SiteMessages::AccountMask->{AlreadyTryNBuy} + LJ::SiteMessages::AccountMask->{TryNBuy};
     }
 
     # default values for year/month/day = today's date
@@ -142,7 +145,7 @@
           value => $countries ) . "</td></tr>";
     $ret .= "<tr><td>&nbsp;</td><td>(if left blank, a user's country will be ignored)</td></tr>";
 
-    $ret .= "<tr><td valign='top'>Show this question to:</td><td>";
+    $ret .= "<tr><td valign='top'>Show this question to:<br>ATTENTION!<br>Check SUP or NonSUP or both!<br>Same for TryNBuy applies.</td><td>";
     foreach my $type (sort { LJ::SiteMessages::AccountMask()->{$b} <=> LJ::SiteMessages::AccountMask()->{$a} } keys %{&LJ::SiteMessages::AccountMask()}) {
         my $ltype = lc $type;
         $ret .= $class->html_check

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