r100595 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100594‎ | r100595 | r100596 >
Date:09:53, 24 October 2011
Author:nikerabbit
Status:ok
Tags:
Comment:
* Disallow reviewing own translations
* Show disabled review button and the reason in a tooltip
* Speak about fuzzy translations instead of fuzzy messages
Modified paths:
  • /trunk/extensions/Translate/Translate.i18n.php (modified) (history)
  • /trunk/extensions/Translate/api/ApiTranslationReview.php (modified) (history)
  • /trunk/extensions/Translate/utils/MessageTable.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/utils/MessageTable.php
@@ -209,7 +209,7 @@
210210 protected function getReviewButton( TMessage $message ) {
211211 global $wgUser;
212212 $revision = $message->getProperty( 'revision' );
213 - if ( !$this->reviewMode || !$wgUser->isAllowed( 'translate-messagereview' ) || !$revision || $message->hasTag( 'fuzzy' ) ) {
 213+ if ( !$this->reviewMode || !$wgUser->isAllowed( 'translate-messagereview' ) || !$revision ) {
214214 return '';
215215 }
216216
@@ -224,6 +224,14 @@
225225 if ( in_array( $wgUser->getId(), $reviewers ) ) {
226226 $attribs['value'] = wfMessage( 'translate-messagereview-done' )->text();
227227 $attribs['disabled'] = 'disabled';
 228+ } elseif( $message->hasTag( 'fuzzy' ) ) {
 229+ $attribs['value'] = wfMessage( 'translate-messagereview-submit' )->text();
 230+ $attribs['disabled'] = 'disabled';
 231+ $attribs['title'] = wfMessage( 'translate-messagereview-no-fuzzy' )->text();
 232+ } elseif( $wgUser->getName() === $message->author() ) {
 233+ $attribs['value'] = wfMessage( 'translate-messagereview-submit' )->text();
 234+ $attribs['disabled'] = 'disabled';
 235+ $attribs['title'] = wfMessage( 'translate-messagereview-no-own' )->text();
228236 } else {
229237 $attribs['value'] = wfMessage( 'translate-messagereview-submit' )->text();
230238 }
Index: trunk/extensions/Translate/Translate.i18n.php
@@ -374,10 +374,14 @@
375375 'translate-messagereview-done' => 'Reviewed',
376376 'translate-messagereview-apierror-invalidrevision' => 'Translation was not found',
377377 'translate-messagereview-apierror-unknownmessage' => 'Message was not found',
378 - 'translate-messagereview-apierror-fuzzymessage' => 'Message is marked as fuzzy',
 378+ 'translate-messagereview-apierror-fuzzymessage' => 'Translation is marked as fuzzy',
 379+ 'translate-messagereview-apierror-owntranslation' => 'You cannot review your own translations.',
379380 'translate-messagereview-reviews' => 'Reviewed by {{PLURAL:$1|one user|$1 users}}',
380381 'translate-messagereview-reviewswithyou' => 'Reviewed by {{PLURAL:$1|one user|$1 users}} including you',
381382 'translate-messagereview-reviewsyou' => 'Reviewed by you',
 383+
 384+ 'translate-messagereview-no-fuzzy' => 'Fuzzy translations cannot be reviewed',
 385+ 'translate-messagereview-no-own' => 'You cannot review your own translations',
382386 );
383387
384388 /** Message documentation (Message documentation)
@@ -595,9 +599,12 @@
596600 'translate-messagereview-apierror-invalidrevision' => 'Error message for {{msg-mw|translate-messagereview-failure}}',
597601 'translate-messagereview-apierror-unknownmessage' => 'Error message for {{msg-mw|translate-messagereview-failure}}',
598602 'translate-messagereview-apierror-fuzzymessage' => 'Error message for {{msg-mw|translate-messagereview-failure}}',
 603+ 'translate-messagereview-apierror-owntranslation' => 'Error message for {{msg-mw|translate-messagereview-failure}}',
599604 'translate-messagereview-reviews' => 'Status message in Special:Translate in review mode',
600605 'translate-messagereview-reviewswithyou' => 'Status message in Special:Translate in review mode',
601606 'translate-messagereview-reviewsyou' => 'Status message in Special:Translate in review mode',
 607+ 'translate-messagereview-no-fuzzy' => 'Tooltip for disabled review button',
 608+ 'translate-messagereview-no-own' => 'Tooltip for disabled review button',
602609 );
603610
604611 /** Faeag Rotuma (Faeag Rotuma)
Index: trunk/extensions/Translate/api/ApiTranslationReview.php
@@ -34,9 +34,13 @@
3535 }
3636
3737 if ( $handle->isFuzzy() ) {
38 - $this->dieUsage( 'Cannot review fuzzy messages', 'fuzzymessage' );
 38+ $this->dieUsage( 'Cannot review fuzzy translations', 'fuzzymessage' );
3939 }
4040
 41+ if ( $revision->getUser() == $wgUser->getId() ) {
 42+ $this->dieUsage( 'Cannot review own translations', 'owntranslation' );
 43+ }
 44+
4145 $dbw = wfGetDB( DB_MASTER );
4246 $table = 'translate_reviews';
4347 $row = array(
@@ -99,7 +103,8 @@
100104 return array_merge( parent::getPossibleErrors(), array(
101105 array( 'code' => 'permissiondenied', 'info' => 'You must have translate-messagereview right' ),
102106 array( 'code' => 'unknownmessage', 'info' => 'Title $1 does not belong to a message group' ),
103 - array( 'code' => 'fuzzymessage', 'info' => 'Cannot review fuzzy messages' ),
 107+ array( 'code' => 'fuzzymessage', 'info' => 'Cannot review fuzzy translations' ),
 108+ array( 'code' => 'owntranslation', 'info' => 'Cannot review own translations' ),
104109 array( 'code' => 'invalidrevision', 'info' => 'Revision $1 is invalid' ),
105110 ) );
106111 }

Status & tagging log