Make Special:Unblock link to contributions page for IP blockees
authorTK-999 <tk.999.wikia@gmail.com>
Tue, 8 Jul 2014 21:21:15 +0000 (23:21 +0200)
committerUmherirrender <umherirrender_de.wp@web.de>
Fri, 12 Sep 2014 18:07:32 +0000 (18:07 +0000)
Currently, Special:Unblock links to the user page of anon editors,
which is inconsistent with other areas of the software,
and also less useful, as IP userpages are often redlinks.
This patch converts these links to Contributions links.

Originally reported on Wikia, with an (incomplete) patch here:
https://github.com/WikiaVolDev/app/compare/VOLDEV-31

Change-Id: I0fc73c7ee4fd7c81ed876717e8f60749c51685ae

includes/specials/SpecialUnblock.php
languages/i18n/en.json
languages/i18n/qqq.json

index 96e4dbf..244b889 100644 (file)
@@ -63,8 +63,10 @@ class SpecialUnblock extends SpecialPage {
 
                if ( $form->show() ) {
                        switch ( $this->type ) {
-                               case Block::TYPE_USER:
                                case Block::TYPE_IP:
+                                       $out->addWikiMsg( 'unblocked-ip', wfEscapeWikiText( $this->target ) );
+                                       break;
+                               case Block::TYPE_USER:
                                        $out->addWikiMsg( 'unblocked', wfEscapeWikiText( $this->target ) );
                                        break;
                                case Block::TYPE_RANGE:
@@ -111,8 +113,14 @@ class SpecialUnblock extends SpecialPage {
                                $fields['Target']['default'] = $target;
                                $fields['Target']['type'] = 'hidden';
                                switch ( $type ) {
-                                       case Block::TYPE_USER:
                                        case Block::TYPE_IP:
+                                               $fields['Name']['default'] = Linker::linkKnown(
+                                                       SpecialPage::getTitleFor( 'Contributions', $target->getName() ),
+                                                       $target->getName()
+                                               );
+                                               $fields['Name']['raw'] = true;
+                                               break;
+                                       case Block::TYPE_USER:
                                                $fields['Name']['default'] = Linker::link(
                                                        $target->getUserPage(),
                                                        $target->getName()
index 6fe2ee2..574d977 100644 (file)
        "unblocked": "[[User:$1|$1]] has been unblocked.",
        "unblocked-range": "$1 has been unblocked.",
        "unblocked-id": "Block $1 has been removed.",
+       "unblocked-ip": "[[Special:Contributions/$1|$1]] has been unblocked.",
        "blocklist": "Blocked users",
        "ipblocklist": "Blocked users",
        "ipblocklist-legend": "Find a blocked user",
index 63bd617..4d9ca6c 100644 (file)
        "unblockip": "Used as legend for the form in [[Special:Unblock]].",
        "unblockiptext": "Used in the {{msg-mw|Unblockip}} form on [[Special:Unblock]].",
        "ipusubmit": "Used as button text on [{{canonicalurl:Special:BlockList|action=unblock}} Special:BlockList?action=unblock]. To see the message:\n* Go to [[Special:BlockList]]\n* Click \"unblock\" for any block (but you can only see \"unblock\" if you have administrator rights)\n* It is now the button below the form",
-       "unblocked": "{{doc-important|Do not translate the namespace \"User:\".}}\nParameters:\n* $1 - the IP address or username that was unblocked\nSee also:\n* {{msg-mw|Unblocked-range}}\n* {{msg-mw|Unblocked-id}}",
-       "unblocked-range": "Shown when successfully lifting a rangeblock, so do not link to contributions. Parameters:\n* $1 - the range that was unblocked\nSee also:\n* {{msg-mw|Unblocked}}\n* {{msg-mw|Unblocked-id}}",
+       "unblocked": "{{doc-important|Do not translate the namespace \"User:\".}}\nParameters:\n* $1 - the username that was unblocked\nSee also:\n* {{msg-mw|Unblocked-range}}\n* {{msg-mw|Unblocked-id}}\n*{{msg-mw|Unblocked-ip}}",
+       "unblocked-range": "Shown when successfully lifting a rangeblock, so do not link to contributions. Parameters:\n* $1 - the range that was unblocked\nSee also:\n* {{msg-mw|Unblocked}}\n* {{msg-mw|Unblocked-id}}\n*{{msg-mw|Unblocked-ip}}",
        "unblocked-id": "Used in [[Special:Unblock]]. Parameters:\n* $1 - autoblock ID\nSee also:\n* {{msg-mw|Unblocked}}\n* {{msg-mw|Unblocked-range}}",
+       "unblocked-ip": "{{doc-important|Do not translate the title \"Special:Contributions\".}}\nParameters:\n* $1 - the IP address that was unblocked\nSee also:\n* {{msg-mw|Unblocked-range}}\n* {{msg-mw|Unblocked-id}}\n*{{msg-mw|Unblocked}}",
        "blocklist": "{{doc-special|BlockList}}",
        "ipblocklist": "Title of [[Special:Ipblocklist]].",
        "ipblocklist-legend": "Used as legend of the form in [[Special:BlockList]].\n\nSee also:\n* {{msg-mw|Ipblocklist-legend}}\n* {{msg-mw|Ipblocklist-submit}}",