Huji has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/380420 )

Change subject: CheckUser "contributions" link should be a red link for 
non-existent accounts
......................................................................


CheckUser "contributions" link should be a red link for non-existent accounts

In Special:CheckUser, when a user had tried create and account while this was 
prevented by abusefilter, his or her "contributions" link was still blue 
instead of a red link (as if that user actually exists). The patch add takes 
advantage of the existing yet unsued css class .mw-anonuserlink, and turn the 
link to red.

Bug: T170507
Change-Id: I669affa176f6c5b0dbf61ac3ca4e77a4fb6eb3e5
---
M i18n/en.json
M i18n/qqq.json
M specials/SpecialCheckUser.php
3 files changed, 50 insertions(+), 9 deletions(-)

Approvals:
  Huji: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/i18n/en.json b/i18n/en.json
index ce5d335..cfe7fe9 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -81,8 +81,7 @@
        "checkuser-create-action": "was created",
        "checkuser-email-action": "sent an email to user \"$1\"",
        "checkuser-reset-action": "reset password for user \"$1\"",
-       "checkuser-userlinks-ip": "([[User_talk:$1|talk]] | 
[[Special:Contributions/$1|contribs]] | [[Special:Block/$1|block]] | <span 
class=\"plainlinks\">[https://www.robtex.com/whois/$1.html WHOIS/RDNS]</span>)",
-       "checkuser-userlinks": "([[User_talk:$1|talk]] | 
[[Special:Contributions/$1|contribs]] | [[Special:Block/$1|block]])",
+       "checkuser-userlinks-ip": "(<span 
class=\"plainlinks\">[https://www.robtex.com/whois/$1.html WHOIS/RDNS]</span>)",
        "checkuser-toollinks": "<span 
class=\"plainlinks\">[[https://www.robtex.com/whois/$1.html WHOIS/RDNS] 
·\n[https://www.robtex.com/rbls/$1.html RBLs] 
·\n[http://www.dnsstuff.com/tools/tracert.ch?ip=$1 Traceroute] 
·\n[https://www.ip2location.com/$1 Geolocate] 
·\n[https://www.dan.me.uk/torcheck?ip=$1 Tor check]]</span>",
        "checkuser-token-fail": "Session failure. Please try again.",
        "group-checkuser.css": "/* CSS placed here will affect checkuser only 
*/",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index a80836a..4a5a710 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -104,7 +104,6 @@
        "checkuser-email-action": "Logged text when a user sends an e-mail. 
Probably preceded by the name of the checkuser.\n\nParameters:\n* $1 - a salted 
MD5 hash for the user an email was sent to",
        "checkuser-reset-action": "Logged text when a user resets a password. 
Parameters:\n* $1 - the username for which the password was reset. Can be used 
for GENDER.",
        "checkuser-userlinks-ip": "Links shown next to an IP address in a 
CheckUser result entry. $1 - IP address\n\nSee 
also:\n*{{msg-mw|Signature}}\n*{{msg-mw|Checkuser-userlinks}}",
-       "checkuser-userlinks": "Links shown next to a user in a CheckUser 
result entry. $1 - Name of user\n\nSee 
also:\n*{{msg-mw|Signature}}\n*{{msg-mw|Checkuser-userlinks-ip}}",
        "checkuser-toollinks": "{{notranslate}}\nParameters:\n* $1 - IP 
address",
        "checkuser-token-fail": "Error message shown when the CSRF token does 
not match the current session.",
        "group-checkuser.css": "{{doc-group|checkuser|css}}",
diff --git a/specials/SpecialCheckUser.php b/specials/SpecialCheckUser.php
index 135d825..cee2dd2 100644
--- a/specials/SpecialCheckUser.php
+++ b/specials/SpecialCheckUser.php
@@ -1074,12 +1074,34 @@
                                $s .= '<li>';
                                $s .= Xml::check( 'users[]', false, [ 'value' 
=> $name ] ) . '&#160;';
                                // Load user object
-                               $user = User::newFromName( $name, false );
+                               $usernfn = User::newFromName( $name, false );
                                // Add user page and tool links
-                               $s .= Linker::userLink( -1, $name ) . ' ';
+                               if ( !IP::isIPAddress( $usernfn ) ) {
+                                       $idforlinknfn = -1;
+                               } else {
+                                       $idforlinknfn = $users_ids[$name];
+                               }
+                               $user = User::newFromId( $users_ids[$name] );
+                               $classnouser = false;
+                               if ( IP::isIPAddress( $name ) !== 
IP::isIPAddress( $user ) ) {
+                                       // User does not exist
+                                       $idforlink = -1;
+                                       $classnouser = true;
+                               } else {
+                                       $idforlink = $users_ids[$name];
+                               }
+                               if ( $classnouser === true ) {
+                                       $s .= '<span 
class=\'mw-checkuser-nonexistent-user\'>';
+                               } else {
+                                       $s .= '<span>';
+                               }
+                               $s .= Linker::userLink( $idforlinknfn, $name, 
$name ) . '</span> ';
                                $ip = IP::isIPAddress( $name ) ? $name : '';
-                               $linksMsgKey = $ip ? 'checkuser-userlinks-ip' : 
'checkuser-userlinks';
-                               $s .= $this->msg( $linksMsgKey, $name 
)->parse();
+                               $s .= Linker::userToolLinksRedContribs(
+                                       $idforlink, $name, 
$user->getEditCount() ) . ' ';
+                               if ( $ip ) {
+                                       $s .= $this->msg( 
'checkuser-userlinks-ip', $name )->parse();
+                               }
                                // Add CheckUser link
                                $s .= ' ' . $this->msg( 'parentheses' 
)->rawParams(
                                        $this->getSelfLink(
@@ -1328,8 +1350,29 @@
                        $this->getLanguage()->time( wfTimestamp( TS_MW, 
$row->cuc_timestamp ), true, true )
                        . ' . . ';
                // Userlinks
-               $line .= Linker::userLink( $row->cuc_user, $row->cuc_user_text 
);
-               $line .= Linker::userToolLinks( $row->cuc_user, 
$row->cuc_user_text );
+               $user = User::newFromId( $row->cuc_user );
+               if ( !IP::isIPAddress( $row->cuc_user_text ) ) {
+                       $idforlinknfn = -1;
+               } else {
+                       $idforlinknfn = $row->cuc_user;
+               }
+               $classnouser = false;
+               if ( IP::isIPAddress( $row->cuc_user_text ) !== 
IP::isIPAddress( $user ) ) {
+                       // User does not exist
+                       $idforlink = -1;
+                       $classnouser = true;
+               } else {
+                       $idforlink = $row->cuc_user;
+               }
+               if ( $classnouser === true ) {
+                       $line .= '<span 
class=\'mw-checkuser-nonexistent-user\'>';
+               } else {
+                       $line .= '<span>';
+               }
+               $line .= Linker::userLink(
+                       $idforlinknfn, $row->cuc_user_text, $row->cuc_user_text 
) . '</span>';
+               $line .= Linker::userToolLinksRedContribs(
+                       $idforlink, $row->cuc_user_text, $user->getEditCount() 
);
                // Get block info
                if ( isset( $flagCache[$row->cuc_user_text] ) ) {
                        $flags = $flagCache[$row->cuc_user_text];

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I669affa176f6c5b0dbf61ac3ca4e77a4fb6eb3e5
Gerrit-PatchSet: 11
Gerrit-Project: mediawiki/extensions/CheckUser
Gerrit-Branch: master
Gerrit-Owner: African Hope <samuelgu...@gmail.com>
Gerrit-Reviewer: African Hope <samuelgu...@gmail.com>
Gerrit-Reviewer: D3r1ck01 <alangider...@gmail.com>
Gerrit-Reviewer: Huji <huji.h...@gmail.com>
Gerrit-Reviewer: Legoktm <lego...@member.fsf.org>
Gerrit-Reviewer: Melos <webme...@gmail.com>
Gerrit-Reviewer: Paladox <thomasmulhall...@yahoo.com>
Gerrit-Reviewer: Reedy <re...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to