Anomie has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/404696 )

Change subject: SpecialLog: Don't ignore offender when it's a nonexistent 
username
......................................................................

SpecialLog: Don't ignore offender when it's a nonexistent username

When viewing the suppression log, the 'offender' field is ignored if it
specifies a username that happens to not exist locally. It would make
more sense for it to filter by that name and return an empty list.

Ideally such searches would have the possibility of succeeding, since
imported log entries can be attributed to a nonexistent user, but the
necessary data isn't currently being stored. The actor table patch
(I8d825eb0) will start storing that data once migration begins, although
a maintenance script run would be needed to populate it for old log
entries.

Change-Id: I73ac78f7623178ab878135b910a22013723885d3
---
M includes/specials/SpecialLog.php
1 file changed, 6 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/96/404696/1

diff --git a/includes/specials/SpecialLog.php b/includes/specials/SpecialLog.php
index 511cfbf..de3fd19 100644
--- a/includes/specials/SpecialLog.php
+++ b/includes/specials/SpecialLog.php
@@ -79,10 +79,12 @@
                $qc = [];
                if ( $opts->getValue( 'type' ) == 'suppress' ) {
                        $offender = User::newFromName( $opts->getValue( 
'offender' ), false );
-                       if ( $offender && $offender->getId() > 0 ) {
-                               $qc = [ 'ls_field' => 'target_author_id', 
'ls_value' => $offender->getId() ];
-                       } elseif ( $offender && IP::isIPAddress( 
$offender->getName() ) ) {
-                               $qc = [ 'ls_field' => 'target_author_ip', 
'ls_value' => $offender->getName() ];
+                       if ( $offender ) {
+                               if ( $offender->getId() > 0 ) {
+                                       $qc = [ 'ls_field' => 
'target_author_id', 'ls_value' => $offender->getId() ];
+                               } else {
+                                       $qc = [ 'ls_field' => 
'target_author_ip', 'ls_value' => $offender->getName() ];
+                               }
                        }
                } else {
                        // Allow extensions to add relations to their search 
types

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I73ac78f7623178ab878135b910a22013723885d3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Anomie <bjor...@wikimedia.org>

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

Reply via email to