Merge "List grant codenames next to grants on Special:ListGrants"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 29 Nov 2016 22:49:21 +0000 (22:49 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 29 Nov 2016 22:49:21 +0000 (22:49 +0000)
includes/specials/SpecialListgrants.php
includes/user/User.php
languages/i18n/en.json
languages/i18n/qqq.json

index 39c8ae8..2c92410 100644 (file)
@@ -71,8 +71,14 @@ class SpecialListGrants extends SpecialPage {
 
                        $id = \Sanitizer::escapeId( $grant );
                        $out->addHTML( \Html::rawElement( 'tr', [ 'id' => $id ],
-                               "<td>" . $this->msg( "grant-$grant" )->escaped() . "</td>" .
-                               "<td>" . $grantCellHtml . '</td>'
+                               "<td>" .
+                               $this->msg(
+                                       "listgrants-grant-display",
+                                       \User::getGrantName( $grant ),
+                                       "<span class='mw-listgrants-grant-name'>" . $id . "</span>"
+                               )->parse() .
+                               "</td>" .
+                               "<td>" . $grantCellHtml . "</td>"
                        ) );
                }
 
index 82d8806..b6a64b0 100644 (file)
@@ -5075,6 +5075,19 @@ class User implements IDBAccessObject {
                return $msg->isBlank() ? $right : $msg->text();
        }
 
+       /**
+        * Get the name of a given grant
+        *
+        * @since 1.29
+        * @param string $grant Grant to query
+        * @return string Localized name of the grant
+        */
+       public static function getGrantName( $grant ) {
+               $key = "grant-$grant";
+               $msg = wfMessage( $key );
+               return $msg->isDisabled() ? $grant : $msg->text();
+       }
+
        /**
         * Make a new-style password hash
         *
index 3a8a7ae..a49f95c 100644 (file)
        "listgrants-summary": "The following is a list of grants with their associated access to user rights. Users can authorize applications to use their account, but with limited permissions based on the grants the user gave to the application. An application acting on behalf of a user cannot actually use rights that the user does not have however.\nThere may be [[{{MediaWiki:Listgrouprights-helppage}}|additional information]] about individual rights.",
        "listgrants-grant": "Grant",
        "listgrants-rights": "Rights",
+       "listgrants-grant-display": "$1 <code>($2)</code>",
        "trackingcategories": "Tracking categories",
        "trackingcategories-summary": "This page lists tracking categories which are automatically populated by the MediaWiki software. Their names can be changed by altering the relevant system messages in the {{ns:8}} namespace.",
        "trackingcategories-msg": "Tracking category",
index d175c86..84bca9a 100644 (file)
        "listgrants-summary": "Explanatory text shown at the top of the grant/rights mapping table.\n\nRefers to {{msg-mw|Listgrouprights-helppage}}.",
        "listgrants-grant": "Used as table header for the grant/rights mapping table.\n{{Identical|Grant}}",
        "listgrants-rights": "Used as table header for the grant/rights mapping table.\n{{Identical|Right}}",
+       "listgrants-grant-display": "{{optional}}\nUsed to display the code name of a grant next to the grant. Parameters:\n* $1 - the text from the \"grant-...\" messages, i.e. {{msg-mw|Grant-highvolume}}\n* $2 - the codename of this grant",
        "trackingcategories": "[[Special:TrackingCategories]] page implementing list of Tracking categories [[mw:Special:MyLanguage/Help:Tracking categories|tracking category]].\n{{Identical|Tracking category}}",
        "trackingcategories-summary": "Description for [[Special:TrackingCategories]] page [[mw:Help:Tracking categories|tracking category]]",
        "trackingcategories-msg": "Header for the message column of the table on [[Special:TrackingCategories]]. This column lists the mediawiki message that controls the tracking category in question.\n{{Identical|Tracking category}}",