Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/169601

Change subject: Don't let users merge themselves
......................................................................

Don't let users merge themselves

Change-Id: Idb92ec8bc0ab20d4c1036dfdad69cfb876a2813a
---
M i18n/en.json
M i18n/qqq.json
M includes/specials/SpecialGlobalUserMerge.php
3 files changed, 8 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralAuth 
refs/changes/01/169601/1

diff --git a/i18n/en.json b/i18n/en.json
index fe52581..87ae88c 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -401,6 +401,7 @@
        "centralauth-usermerge-queued": "Merges for $1 into $2 have been 
queued.\n\nView the progress at [[Special:GlobalRenameProgress/$3]].",
        "centralauth-usermerge-invalid": "There is no global account with the 
name \"$1\".",
        "centralauth-usermerge-already": "There is already a global rename or 
merge in progress for $1.",
+       "centralauth-usermerge-noself": "You cannot merge accounts with 
yourself.",
        "action-centralauth-usermerge": "globally merge multiple users",
        "right-centralauth-usermerge": "Globally merge multiple users",
        "centralauth-usermerge-confirm": "Do you really want to globally merge 
these users?",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 1b6d508..5ccdb05 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -411,6 +411,7 @@
        "centralauth-usermerge-queued": "Message shown after successfully 
submitting the form. Parameters:\n* $1 - a comma-separated list of users who 
are being merged into\n* $2 - a link to the final username's 
[[Special:CentralAuth]] page\n* $3 - the raw final username",
        "centralauth-usermerge-invalid": "Error message shown if the user 
enters invalid input. Parameters:\n* $1 - the invalid input",
        "centralauth-usermerge-already": "Error message if a user is already 
being globally renamed or merged.\n\nParmaeters:\n* $1 - the user's username",
+       "centralauth-usermerge-noself": "Error message shown if a user tries 
merging accounts with themselves.",
        "action-centralauth-usermerge": "{{doc-action|centralauth-usermerge}}",
        "right-centralauth-usermerge": "{{doc-right|centralauth-usermerge}}",
        "centralauth-usermerge-confirm": "Confirmation message displayed in a 
JavaScript alert before the form is submitted.\n\nSee also:\n* 
{{msg-mw|Centralauth-rename-confirm}}",
diff --git a/includes/specials/SpecialGlobalUserMerge.php 
b/includes/specials/SpecialGlobalUserMerge.php
index cab88fd..feff05e 100644
--- a/includes/specials/SpecialGlobalUserMerge.php
+++ b/includes/specials/SpecialGlobalUserMerge.php
@@ -90,6 +90,11 @@
                if ( !$name ) {
                        return $this->msg( 'centralauth-usermerge-invalid', 
$name )->escaped();
                }
+
+               if ( $name === $this->getUser()->getName() ) {
+                       return $this->msg( 'centralauth-usermerge-noself' 
)->escaped();
+               }
+
                $caUser = new CentralAuthUser( $name );
                if ( !$caUser->exists() ) {
                        return $this->msg( 'centralauth-usermerge-invalid', 
$name )->escaped();
@@ -139,7 +144,7 @@
 
                foreach ( $data['usernames'] as $field ) {
                        if ( $field['name'] ) {
-                               $this->oldCAUsers[] = new CentralAuthUser( 
$field['name'] );
+                               $this->oldCAUsers[] = new CentralAuthUser( 
User::getCanonicalName( $field['name'] ) );
                        }
                }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idb92ec8bc0ab20d4c1036dfdad69cfb876a2813a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralAuth
Gerrit-Branch: master
Gerrit-Owner: Legoktm <legoktm.wikipe...@gmail.com>

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

Reply via email to