r44275 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44274‎ | r44275 | r44276 >
Date:21:16, 6 December 2008
Author:ialex
Status:ok
Tags:
Comment:
(bug 16577) When a blocked user tries to rollback a page, the block message is now only displayed once
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Article.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Article.php
@@ -2493,16 +2493,18 @@
24942494 $resultDetails = null;
24952495
24962496 # Check permissions
2497 - $errors = array_merge( $this->mTitle->getUserPermissionsErrors( 'edit', $wgUser ),
2498 - $this->mTitle->getUserPermissionsErrors( 'rollback', $wgUser ) );
 2497+ $editErrors = $this->mTitle->getUserPermissionsErrors( 'edit', $wgUser );
 2498+ $rollbackErrors = $this->mTitle->getUserPermissionsErrors( 'rollback', $wgUser );
 2499+ $errors = array_merge( $editErrors, wfArrayDiff2( $rollbackErrors, $editErrors ) );
 2500+
24992501 if( !$wgUser->matchEditToken( $token, array( $this->mTitle->getPrefixedText(), $fromP ) ) )
25002502 $errors[] = array( 'sessionfailure' );
25012503
2502 - if( $wgUser->pingLimiter('rollback') || $wgUser->pingLimiter() ) {
 2504+ if( $wgUser->pingLimiter( 'rollback' ) || $wgUser->pingLimiter() ) {
25032505 $errors[] = array( 'actionthrottledtext' );
25042506 }
25052507 # If there were errors, bail out now
2506 - if(!empty($errors))
 2508+ if( !empty( $errors ) )
25072509 return $errors;
25082510
25092511 return $this->commitRollback($fromP, $summary, $bot, $resultDetails);
@@ -2637,10 +2639,6 @@
26382640 $details
26392641 );
26402642
2641 - if( in_array( array( 'blocked' ), $result ) ) {
2642 - $wgOut->blockedPage();
2643 - return;
2644 - }
26452643 if( in_array( array( 'actionthrottledtext' ), $result ) ) {
26462644 $wgOut->rateLimited();
26472645 return;
@@ -2662,7 +2660,7 @@
26632661 # Display permissions errors before read-only message -- there's no
26642662 # point in misleading the user into thinking the inability to rollback
26652663 # is only temporary.
2666 - if( !empty($result) && $result !== array( array('readonlytext') ) ) {
 2664+ if( !empty( $result ) && $result !== array( array( 'readonlytext' ) ) ) {
26672665 # array_diff is completely broken for arrays of arrays, sigh. Re-
26682666 # move any 'readonlytext' error manually.
26692667 $out = array();
@@ -2674,7 +2672,7 @@
26752673 $wgOut->showPermissionsErrorPage( $out );
26762674 return;
26772675 }
2678 - if( $result == array( array('readonlytext') ) ) {
 2676+ if( $result == array( array( 'readonlytext' ) ) ) {
26792677 $wgOut->readOnlyPage();
26802678 return;
26812679 }
Index: trunk/phase3/RELEASE-NOTES
@@ -389,6 +389,8 @@
390390 markup now.
391391 * (bug 16529) Fix for search suggestions with some third-party JS libraries
392392 * (bug 13342) importScript() generates more consistent URI encoding
 393+* (bug 16577) When a blocked user tries to rollback a page, the block message
 394+ is now only displayed once
393395
394396
395397 === API changes in 1.14 ===

Status & tagging log