Legoktm has uploaded a new change for review.
https://gerrit.wikimedia.org/r/175750
Change subject: [WIP] Display username for AntiSpoof conflicts
......................................................................
[WIP] Display username for AntiSpoof conflicts
Change-Id: I35f8e7aa756ac1b2759a85066edb7f780b02f03a
---
M i18n/en.json
M i18n/qqq.json
M includes/specials/SpecialGlobalRenameUser.php
3 files changed, 31 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralAuth
refs/changes/50/175750/1
diff --git a/i18n/en.json b/i18n/en.json
index 86018cb..8f4a5ee 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -375,7 +375,8 @@
"centralauth-rename-alreadyinprogress" : "There is already a rename for
this user in [[Special:GlobalRenameProgress/$1|progress]].",
"centralauth-renameuser-global-inprogress": "There is already a global
rename for $1 in [[Special:GlobalRenameProgress/$1|progress]].",
"centralauth-rename-queued" : "Jobs to rename $1 to $2 have been queued
on $3.\n\nView the progress at [[Special:GlobalRenameProgress/$2]].",
- "centralauth-rename-antispoofconflicts": "The chosen username is too
similar to existing usernames.",
+ "centralauth-rename-antispoofconflicts2": "The chosen username is too
similar to existing usernames: $1.",
+ "centralauth-rename-conflict-hidden": "username hidden",
"centralauth-rename-progress-username" : "Username",
"centralauth-rename-notinprogress" : "There are no renames in progress
for $1. They may have already finished.",
"centralauth-rename-table-domain" : "Local wiki",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index d21004e..7350faf 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -386,7 +386,8 @@
"centralauth-rename-alreadyinprogress": "Error message if the user is
already being renamed. $1 the new username.",
"centralauth-renameuser-global-inprogress": "Error message shown on
Special:RenameUser if a local rename is attempted while a global one is in
progress.\n\n* $1 is the user being renamed's username",
"centralauth-rename-queued": "Message shown after the rename has
started.\n\n* $1 is the user's old name\n* $2 is the user's new name\n* $3 is a
list of the database names where rename jobs have been queued",
- "centralauth-rename-antispoofconflicts": "Error message shown if the
username conflicts with an existing one in AntiSpoof",
+ "centralauth-rename-antispoofconflicts2": "Error message shown if the
username conflicts with an existing one in AntiSpoof. $1 is a comma-separated
list of conflicting usernames",
+ "centralauth-rename-conflict-hidden": "Text displayed instead of the
username if the user has been hidden",
"centralauth-rename-progress-username": "{{identical|Username}}\nLabel
for username form field on Special:RenameProgress",
"centralauth-rename-notinprogress": "Message shown when there is no
rename in progress for the provided user\n* $1 is the username",
"centralauth-rename-table-domain": "{{Identical|Local wiki}}\nTable
column header for domain name of wiki",
diff --git a/includes/specials/SpecialGlobalRenameUser.php
b/includes/specials/SpecialGlobalRenameUser.php
index da0aeaf..5feb02c 100644
--- a/includes/specials/SpecialGlobalRenameUser.php
+++ b/includes/specials/SpecialGlobalRenameUser.php
@@ -104,8 +104,15 @@
if ( !$this->overrideAntiSpoof ) {
$spoofUser = new CentralAuthSpoofUser(
$newUser->getName() );
- if ( $spoofUser->getConflicts() ) {
- return Status::newFatal(
'centralauth-rename-antispoofconflicts' );
+ $conflicts = $this->processAntiSpoofConflicts(
+ $oldUser->getName(),
+ $spoofUser->getConflicts()
+ );
+ if ( $conflicts ) {
+ return Status::newFatal(
+
'centralauth-rename-antispoofconflicts2',
+ $this->getLanguage()->commaList(
$conflicts )
+ );
}
}
@@ -115,6 +122,24 @@
return $status;
}
+ protected function processAntiSpoofConflicts( $oldname, array
$conflicts ) {
+ $display = array();
+ foreach ( $conflicts as $name ) {
+ if ( $name === $oldname ) {
+ // Not a conflict since the old usage will go
away
+ continue;
+ }
+ $ca = new CentralAuthUser( $name );
+ if ( $ca->isHidden() ) {
+ $display[] = $this->msg(
'centralauth-rename-conflict-hidden' )->text();
+ } else {
+ $display[] = $name;
+ }
+ }
+
+ return $display;
+ }
+
/**
* @param array $data
* @return Status
--
To view, visit https://gerrit.wikimedia.org/r/175750
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I35f8e7aa756ac1b2759a85066edb7f780b02f03a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralAuth
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits