[MediaWiki-commits] [Gerrit] mediawiki...CheckUser[master]: CheckUser "contributions" link should be a red link for non-...

2017-10-09 Thread Huji (Code Review)
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]] | [https://www.robtex.com/whois/$1.html WHOIS/RDNS])",
-   "checkuser-userlinks": "([[User_talk:$1|talk]] | 
[[Special:Contributions/$1|contribs]] | [[Special:Block/$1|block]])",
+   "checkuser-userlinks-ip": "([https://www.robtex.com/whois/$1.html WHOIS/RDNS])",
"checkuser-toollinks": "[[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]]",
"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 .= '';
$s .= Xml::check( 'users[]', false, [ 'value' 
=> $name ] ) . '';
// 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 .= '';
+   } else {
+   $s .= '';
+   }
+

[MediaWiki-commits] [Gerrit] mediawiki...CheckUser[master]: CheckUser "contributions" link should be a red link for non-...

2017-09-24 Thread African Hope (Code Review)
African Hope has uploaded a new change for review. ( 
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 extension.json
A modules/ext.checkuser.links.js
2 files changed, 26 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CheckUser 
refs/changes/20/380420/1

diff --git a/extension.json b/extension.json
index 0803a14..a22c7e6 100644
--- a/extension.json
+++ b/extension.json
@@ -78,6 +78,12 @@
"mediawiki.util"
]
},
+   "ext.checkUser": {
+   "scripts": "modules/ext.checkuser.links.js",
+   "dependencies": [
+   "mediawiki.Title"
+   ]
+   },
"ext.checkUser.caMultiLock": {
"scripts": "modules/ext.checkuser.caMultiLock.js",
"dependencies": [
diff --git a/modules/ext.checkuser.links.js b/modules/ext.checkuser.links.js
new file mode 100644
index 000..96b0718
--- /dev/null
+++ b/modules/ext.checkuser.links.js
@@ -0,0 +1,20 @@
+/**
+ * Check existence of links and mark the missing ones red
+ */
+( function ( mw, $ ) {
+   
+   // Find all links with the .new.mw-userlink class, referring to 
unexisting users
+   $("form#checkuserblock #checkuserresults 
a.new.mw-userlink").each(function( i, urlObj  ) {
+
+   // Search for the sibling Contributions link 
+   
if($(urlObj).siblings().has("a[href*='Special:Contributions']")) {
+   
+   var contributionsLink = 
$(urlObj).siblings("a[href*='Special:Contributions']:first");
+
+   // Add class .new 
+   $(contributionsLink).addClass("new"); 
+
+   };
+
+   });
+}( mediaWiki, jQuery ) );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I669affa176f6c5b0dbf61ac3ca4e77a4fb6eb3e5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CheckUser
Gerrit-Branch: master
Gerrit-Owner: African Hope 

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