Jack Phoenix has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/300712

Change subject: Ignore flagged bot accounts in top users lists
......................................................................

Ignore flagged bot accounts in top users lists

This is mainly for consistency, really. UserStats#incStatField and
UserStats#decStatField already ignore anons and bots.

Change-Id: I3130aa7b876c12e2a22db381837025931da92f4f
---
M UserStats/TopFansByStat.php
M UserStats/TopFansRecent.php
M UserStats/TopUsers.php
M UserStats/UserStatsClass.php
4 files changed, 12 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SocialProfile 
refs/changes/12/300712/1

diff --git a/UserStats/TopFansByStat.php b/UserStats/TopFansByStat.php
index 4e27d1b..27355ef 100644
--- a/UserStats/TopFansByStat.php
+++ b/UserStats/TopFansByStat.php
@@ -93,9 +93,11 @@
                                // sadly), since user_stats entries for users 
are *not* purged
                                // and/or merged during the account merge 
process (which is a
                                // different bug with a different extension).
+                               // Also ignore flagged bot accounts, no point 
in showing those
+                               // in the top lists.
                                $exists = $u->loadFromId();
 
-                               if ( !$u->isBlocked() && $exists ) {
+                               if ( !$u->isBlocked() && $exists && 
!$u->isAllowed( 'bot' ) ) {
                                        $user_list[] = array(
                                                'user_id' => 
$row->stats_user_id,
                                                'user_name' => 
$row->stats_user_name,
diff --git a/UserStats/TopFansRecent.php b/UserStats/TopFansRecent.php
index 93dc517..a315d67 100644
--- a/UserStats/TopFansRecent.php
+++ b/UserStats/TopFansRecent.php
@@ -82,9 +82,11 @@
                                // sadly), since user_stats entries for users 
are *not* purged
                                // and/or merged during the account merge 
process (which is a
                                // different bug with a different extension).
+                               // Also ignore flagged bot accounts, no point 
in showing those
+                               // in the top lists.
                                $exists = $u->loadFromId();
 
-                               if ( !$u->isBlocked() && $exists ) {
+                               if ( !$u->isBlocked() && $exists && 
!$u->isAllowed( 'bot' ) ) {
                                        $user_list[] = array(
                                                'user_id' => $row->up_user_id,
                                                'user_name' => 
$row->up_user_name,
diff --git a/UserStats/TopUsers.php b/UserStats/TopUsers.php
index 423e964..2490653 100644
--- a/UserStats/TopUsers.php
+++ b/UserStats/TopUsers.php
@@ -63,9 +63,11 @@
                                // sadly), since user_stats entries for users 
are *not* purged
                                // and/or merged during the account merge 
process (which is a
                                // different bug with a different extension).
+                               // Also ignore flagged bot accounts, no point 
in showing those
+                               // in the top lists.
                                $exists = $user->loadFromId();
 
-                               if ( !$user->isBlocked() && $exists ) {
+                               if ( !$user->isBlocked() && $exists && 
!$user->isAllowed( 'bot' ) ) {
                                        $user_list[] = array(
                                                'user_id' => 
$row->stats_user_id,
                                                'user_name' => 
$row->stats_user_name,
diff --git a/UserStats/UserStatsClass.php b/UserStats/UserStatsClass.php
index 0ba7409..aa6ca28 100644
--- a/UserStats/UserStatsClass.php
+++ b/UserStats/UserStatsClass.php
@@ -860,9 +860,11 @@
                        // sadly), since user_stats entries for users are *not* 
purged
                        // and/or merged during the account merge process 
(which is a
                        // different bug with a different extension).
+                       // Also ignore flagged bot accounts, no point in 
showing those
+                       // in the top lists.
                        $exists = $user->loadFromId();
 
-                       if ( !$user->isBlocked() && $exists ) {
+                       if ( !$user->isBlocked() && $exists && 
!$user->isAllowed( 'bot' )  ) {
                                $list[] = array(
                                        'user_id' => $row->up_user_id,
                                        'user_name' => $row->up_user_name,

-- 
To view, visit https://gerrit.wikimedia.org/r/300712
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3130aa7b876c12e2a22db381837025931da92f4f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SocialProfile
Gerrit-Branch: master
Gerrit-Owner: Jack Phoenix <j...@countervandalism.net>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to