holyandrew (holyandrew) wrote in changelog,
holyandrew
holyandrew
changelog

[livejournal] r22477: LJSUP-13036: Create subroutine for get s...

Committer: akanashin
LJSUP-13036: Create subroutine for get social capital by user
U   trunk/cgi-bin/LJ/Talk/Post.pm
U   trunk/htdocs/tools/endpoints/ctxpopup.bml
U   trunk/htdocs/userinfo.bml
Modified: trunk/cgi-bin/LJ/Talk/Post.pm
===================================================================
--- trunk/cgi-bin/LJ/Talk/Post.pm	2012-07-19 12:36:29 UTC (rev 22476)
+++ trunk/cgi-bin/LJ/Talk/Post.pm	2012-07-19 12:50:28 UTC (rev 22477)
@@ -619,12 +619,10 @@
     ##
     my $soc_cap = 0;
     unless ($anon_commenter) {
-        $soc_cap = LJ::PersonalStats::DB->fetch_raw('ratings', { func => 'get_authority', journal_id => $commenter->userid });
-        $soc_cap = int($soc_cap->{result}->{authority}/1000);
+        $soc_cap = $commenter->get_social_capital();
     }
     return if $soc_cap > 15;
  
- 
     ##
     ## 4. Don't show captcha to the owner of the journal, no more checks
     ##

Modified: trunk/htdocs/tools/endpoints/ctxpopup.bml
===================================================================
--- trunk/htdocs/tools/endpoints/ctxpopup.bml	2012-07-19 12:36:29 UTC (rev 22476)
+++ trunk/htdocs/tools/endpoints/ctxpopup.bml	2012-07-19 12:50:28 UTC (rev 22477)
@@ -140,16 +140,12 @@
                 %filter,
             });
 
-            $soc_capital = LJ::PersonalStats::DB->fetch_raw('ratings', {
-                func => 'get_authority',
-                journal_id => $u->userid,
-            });
+            $soc_capital = $u->get_social_capital(); 
 
             if (ref $position eq 'HASH') {
                 $first = $position->{result}->{position}!=0 ? 0 : 1;
             }
 
-            $soc_capital = int($soc_capital->{result}->{authority}/1000);
             $soc_capital = $soc_capital < 10 ? BML::ml('.social_capital_less_that') : LJ::commafy($soc_capital);
 
         }

Modified: trunk/htdocs/userinfo.bml
===================================================================
--- trunk/htdocs/userinfo.bml	2012-07-19 12:36:29 UTC (rev 22476)
+++ trunk/htdocs/userinfo.bml	2012-07-19 12:50:28 UTC (rev 22477)
@@ -712,8 +712,7 @@
                          "</li>";
         }
  
-        $soc_capital = LJ::PersonalStats::DB->fetch_raw('ratings', {func => 'get_authority', journal_id => $u->userid}); 
-        $soc_capital = int($soc_capital->{result}->{authority}/1000);
+        my $soc_capital = $u->get_social_capital();
         $soc_capital = $soc_capital < 10 ? ' <10 ' : LJ::commafy($soc_capital);
         $soc_image ||= "<img src='$LJ::IMGPREFIX/profile_icons/social-capital.png?v=17298'/>";
 

Tags: akanashin, bml, holyandrew, 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