jenkins-bot has submitted this change and it was merged. Change subject: Display username for AntiSpoof conflicts ......................................................................
Display username for AntiSpoof conflicts Bug: T75573 Change-Id: I35f8e7aa756ac1b2759a85066edb7f780b02f03a --- M i18n/en.json M i18n/qqq.json M includes/specials/SpecialGlobalRenameUser.php 3 files changed, 31 insertions(+), 4 deletions(-) Approvals: CSteipp: Looks good to me, but someone else must approve Aaron Schulz: Looks good to me, approved jenkins-bot: Verified diff --git a/i18n/en.json b/i18n/en.json index 3ccb13a..0c3c02c 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -377,7 +377,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 1b4cde3..f72c718 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -388,7 +388,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 7875fcc..8457367 100644 --- a/includes/specials/SpecialGlobalRenameUser.php +++ b/includes/specials/SpecialGlobalRenameUser.php @@ -106,8 +106,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 ) + ); } } @@ -117,6 +124,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: merged Gerrit-Change-Id: I35f8e7aa756ac1b2759a85066edb7f780b02f03a Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/extensions/CentralAuth Gerrit-Branch: master Gerrit-Owner: Legoktm <legoktm.wikipe...@gmail.com> Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org> Gerrit-Reviewer: CSteipp <cste...@wikimedia.org> Gerrit-Reviewer: Hoo man <h...@online.de> Gerrit-Reviewer: Siebrand <siebr...@kitano.nl> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits