r110469 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110468‎ | r110469 | r110470 >
Date:10:04, 1 February 2012
Author:amire80
Status:resolved (Comments)
Tags:miscextensions 
Comment:
Fix bug 34046. If the same workflow state is already set, show an error message, don't touch the DB and don't log anything.
Modified paths:
  • /trunk/extensions/Translate/Translate.i18n.php (modified) (history)
  • /trunk/extensions/Translate/Translate.php (modified) (history)
  • /trunk/extensions/Translate/api/ApiGroupReview.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/Translate.php
@@ -243,6 +243,7 @@
244244 'translate-workflow-set-do',
245245 'translate-workflow-set-doing',
246246 'translate-workflow-set-done',
 247+ 'translate-workflow-set-error-alreadyset',
247248 ),
248249 ) + $resourcePaths;
249250
Index: trunk/extensions/Translate/Translate.i18n.php
@@ -410,6 +410,7 @@
411411 'translate-workflow-set-do' => 'Set',
412412 'translate-workflow-set-doing' => 'Setting...',
413413 'translate-workflow-set-done' => 'Set!',
 414+ 'translate-workflow-set-error-alreadyset' => 'The requested state is identical to the current state.',
414415 'translate-workflow-autocreated-summary' => 'Automatic creation of page for workflow state $1',
415416 'translate-stats-workflow' => 'Status',
416417
@@ -689,6 +690,7 @@
690691 'translate-workflow-set-do' => 'Submit button text when active',
691692 'translate-workflow-set-doing' => 'Submit button text when waiting for reply from server',
692693 'translate-workflow-set-done' => 'Submit button text when submission completed succesfully',
 694+ 'translate-workflow-set-error-alreadyset' => 'An error message shown in a popup box after pressing the {{msg-mw|translate-workflow-set-do}} button.',
693695 'translate-workflow-autocreated-summary' => 'This is an edit summary for the automatic creation of a workflow state page.',
694696 'translate-stats-workflow' => 'Column header on Special:LanguageStats and Special:MessageGroupStats',
695697 'translate-gethelp' => 'Link to some Translate help page or tutorial.
@@ -9698,6 +9700,7 @@
96999701 'translate-workflow-set-do' => 'הגדרה',
97009702 'translate-workflow-set-doing' => 'מתבצעת הגדרה...',
97019703 'translate-workflow-set-done' => 'הוגדר!',
 9704+ 'translate-workflow-set-error-alreadyset' => 'המצב החדש שביקשת להגדיר כבר מוגדר כעת.',
97029705 'translate-workflow-autocreated-summary' => 'יצירה אוטומטית של דף עם מצב התרגום $1',
97039706 'translate-stats-workflow' => 'מצב',
97049707 'translate-workflowgroup-label' => 'מצבי תרגום',
Index: trunk/extensions/Translate/api/ApiGroupReview.php
@@ -47,6 +47,10 @@
4848 __METHOD__
4949 );
5050
 51+ if ( $currentState == $requestParams['state'] ) {
 52+ $this->dieUsage( wfMessage( 'translate-workflow-set-error-alreadyset' ), 'sameworkflowstate' );
 53+ }
 54+
5155 $dbw = wfGetDB( DB_MASTER );
5256 $table = 'translate_groupreviews';
5357 $row = array(

Follow-up revisions

RevisionCommit summaryAuthorDate
r110582Fixes r110469 - message not localized.amire8016:08, 2 February 2012

Comments

#Comment by Nikerabbit (talk | contribs)   14:03, 2 February 2012

I'd just stick to the way it is done few lines above:

$this->dieUsage( 'Permission denied', 'permissiondenied' );

And add hew new error to

getPossibleErrors
#Comment by 😂 (talk | contribs)   14:52, 2 February 2012

+1. We don't localize API errors.

#Comment by Amire80 (talk | contribs)   16:10, 2 February 2012

Addressed in r110582.

Status & tagging log