r101612 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101611‎ | r101612 | r101613 >
Date:10:57, 2 November 2011
Author:nikerabbit
Status:resolved
Tags:
Comment:
Code cleanup
Modified paths:
  • /trunk/extensions/Translate/api/ApiTranslationReview.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/api/ApiTranslationReview.php
@@ -13,11 +13,12 @@
1414 * @ingroup API TranslateAPI
1515 */
1616 class ApiTranslationReview extends ApiBase {
 17+ protected static $right = 'translate-messagereview';
1718
1819 public function execute() {
1920 global $wgUser;
20 - if ( !$wgUser->isallowed( 'translate-messagereview' ) ) {
21 - $this->dieUsageMsg( 'permissiondenied' );
 21+ if ( !$wgUser->isallowed( self::$right ) ) {
 22+ $this->dieUsage( 'Permission denied', 'permissiondenied' );
2223 }
2324
2425 $params = $this->extractRequestParams();
@@ -104,8 +105,9 @@
105106 }
106107
107108 public function getPossibleErrors() {
 109+ $right = self::$right;
108110 return array_merge( parent::getPossibleErrors(), array(
109 - array( 'code' => 'permissiondenied', 'info' => 'You must have translate-messagereview right' ),
 111+ array( 'code' => 'permissiondenied', 'info' => "You must have $right right" ),
110112 array( 'code' => 'unknownmessage', 'info' => 'Title $1 does not belong to a message group' ),
111113 array( 'code' => 'fuzzymessage', 'info' => 'Cannot review fuzzy translations' ),
112114 array( 'code' => 'owntranslation', 'info' => 'Cannot review own translations' ),
@@ -125,7 +127,7 @@
126128
127129 public static function getToken( $pageid, $title ) {
128130 global $wgUser;
129 - if ( !$wgUser->isAllowed( 'translate-messagereview' ) ) {
 131+ if ( !$wgUser->isAllowed( self::$right ) ) {
130132 return false;
131133 }
132134
@@ -134,7 +136,7 @@
135137 return $cachedToken;
136138 }
137139
138 - $cachedToken = $wgUser->editToken( 'translate-messagereview' );
 140+ $cachedToken = $wgUser->editToken( $this->getTokenSalt() );
139141 return $cachedToken;
140142 }
141143

Follow-up revisions

RevisionCommit summaryAuthorDate
r101622Fix fatal errors in r101612 and r101613nikerabbit13:15, 2 November 2011

Status & tagging log