jenkins-bot has submitted this change and it was merged.

Change subject: Special:CentralAuth: show an error message when a rename is in 
progress
......................................................................


Special:CentralAuth: show an error message when a rename is in progress

Instead of an Exception, show a user friendly message with a link to
Special:GlobalRenameProgress/$username and also include a log entry.

Bug: T97742
Change-Id: Ia6c0606e95e585f0db3393ae53a70f91dcada657
---
M i18n/en.json
M i18n/qqq.json
M includes/specials/SpecialCentralAuth.php
3 files changed, 23 insertions(+), 1 deletion(-)

Approvals:
  Legoktm: Looks good to me, approved
  Glaisher: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/i18n/en.json b/i18n/en.json
index 13e179d..139d81c 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -155,6 +155,7 @@
        "centralauth-admin-reason": "Reason:",
        "centralauth-admin-reason-other": "Other/additional reason:",
        "centralauth-admin-reason-other-select": "Other reason:",
+       "centralauth-admin-rename-in-progress" : "This account is currently 
being renamed. Click [[Special:GlobalRenameProgress/$1|here]] to see the 
current progress. The global rename log for this user is provided below.",
        "centralauth-admin-unhide-nonexistent": "Error: the global account 
\"<nowiki>$1</nowiki>\" does not exist.",
        "centralauth-admin-status": "Set global account status",
        "centralauth-admin-status-intro": "You can use this form to change the 
status of this global account.",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index c3058ad..968e4bc 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -171,6 +171,7 @@
        "centralauth-admin-reason": "{{Identical|Reason}}",
        "centralauth-admin-reason-other": "{{Identical|Other/additional 
reason}}",
        "centralauth-admin-reason-other-select": "Shown on the 
[[Special:CentralAuth]] form in the drop down menu.\n\nSee also:\n* 
{{msg-mw|Centralauth-admin-status-reasons}}\n{{Identical|Other reason}}",
+       "centralauth-admin-rename-in-progress" : "Shown on 
[[Special:CentralAuth]] when the account is currently being renamed. 
Parameters:\n* $1 - global account's name",
        "centralauth-admin-unhide-nonexistent": "Used as error message. 
Parameters:\n* $1 - global account's name",
        "centralauth-admin-status": "This message is used as label of 
fieldset.",
        "centralauth-admin-status-intro": "Introduction of the form.",
diff --git a/includes/specials/SpecialCentralAuth.php 
b/includes/specials/SpecialCentralAuth.php
index 3045696..55d5f49 100644
--- a/includes/specials/SpecialCentralAuth.php
+++ b/includes/specials/SpecialCentralAuth.php
@@ -91,7 +91,18 @@
                        $continue = $this->doSubmit();
                }
 
-               $this->mAttachedLocalAccounts = $globalUser->queryAttached();
+               // Show just a user friendly message when a rename is in 
progress
+               try {
+                       $this->mAttachedLocalAccounts = 
$globalUser->queryAttached();
+               } catch ( Exception $e ) {
+                       if ( $globalUser->renameInProgress() ) {
+                               $this->showRenameInProgressError();
+                               return;
+                       }
+                       // Rethrow
+                       throw $e;
+               }
+
                $this->mUnattachedLocalAccounts = 
$globalUser->queryUnattached();
 
                if ( !$globalUser->exists() && !count( 
$this->mUnattachedLocalAccounts ) ) {
@@ -123,6 +134,15 @@
                $this->showUsernameForm();
        }
 
+       private function showRenameInProgressError() {
+               $this->showError( 'centralauth-admin-rename-in-progress', 
$this->mUserName );
+               $special = new SpecialGlobalRenameProgress();
+               $special->setContext( $this->getContext() );
+               $renameStatus = new GlobalRenameUserStatus( $this->mUserName );
+               $names = $renameStatus->getNames();
+               $special->showLogExtract( $names[1] );
+       }
+
        /**
         * @return bool Returns true if the normal form should be displayed
         */

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia6c0606e95e585f0db3393ae53a70f91dcada657
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/CentralAuth
Gerrit-Branch: master
Gerrit-Owner: Glaisher <[email protected]>
Gerrit-Reviewer: Glaisher <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to