r58352 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r58351‎ | r58352 | r58353 >
Date:02:23, 30 October 2009
Author:aaron
Status:resolved (Comments)
Tags:
Comment:
A few cleanups for r58351
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/diff/DifferenceInterface.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/diff/DifferenceInterface.php
@@ -312,40 +312,38 @@
313313 $newminor = ChangesList::flag( 'minor' );
314314 }
315315
316 - $rdel = ''; $ldel = '';
 316+ $rdel = $ldel = '';
317317 # Handle RevisionDelete links...
318 - if( $wgUser->isAllowed( 'deletedhistory' ) ) {
319 - $canHide = $wgUser->isAllowed( 'deleterevision' );
320 - // Don't show useless link to people who cannot hide revisions
321 - if( $canHide || $this->mOldRev->getVisibility() ) {
322 - if( !$this->mOldRev->userCan( Revision::DELETED_RESTRICTED ) ) {
323 - $ldel = $sk->revDeleteLinkDisabled( $canHide ); // revision was hidden from sysops
324 - } else {
325 - $query = array(
326 - 'type' => 'revision',
327 - 'target' => $this->mOldRev->mTitle->getPrefixedDbkey(),
328 - 'ids' => $this->mOldRev->getId()
329 - );
330 - $ldel = $sk->revDeleteLink( $query,
331 - $this->mOldRev->isDeleted( Revision::DELETED_RESTRICTED ), $canHide );
332 - }
333 - $ldel = "   $ldel ";
 318+ $canHide = $wgUser->isAllowed( 'deleterevision' );
 319+ // Don't show useless link to people who cannot hide revisions
 320+ if( $canHide || ($this->mOldRev->getVisibility() && $wgUser->isAllowed('deletedhistory')) ) {
 321+ if( !$this->mOldRev->userCan( Revision::DELETED_RESTRICTED ) ) {
 322+ $ldel = $sk->revDeleteLinkDisabled( $canHide ); // revision was hidden from sysops
 323+ } else {
 324+ $query = array(
 325+ 'type' => 'revision',
 326+ 'target' => $this->mOldRev->mTitle->getPrefixedDbkey(),
 327+ 'ids' => $this->mOldRev->getId()
 328+ );
 329+ $ldel = $sk->revDeleteLink( $query,
 330+ $this->mOldRev->isDeleted( Revision::DELETED_RESTRICTED ), $canHide );
334331 }
335 - // Don't show useless link to people who cannot hide revisions
336 - if( $this->mNewRev->getVisibility() || $wgUser->isAllowed( 'deleterevision' ) ) {
337 - if( !$this->mNewRev->userCan( Revision::DELETED_RESTRICTED ) ) {
338 - $rdel = $sk->revDeleteLinkDisabled( $canHide ); // revision was hidden from sysops
339 - } else {
340 - $query = array(
341 - 'type' => 'revision',
342 - 'target' => $this->mNewRev->mTitle->getPrefixedDbkey(),
343 - 'ids' => $this->mNewRev->getId()
344 - );
345 - $rdel = $sk->revDeleteLink( $query,
346 - $this->mNewRev->isDeleted( Revision::DELETED_RESTRICTED ), $canHide );
347 - }
348 - $rdel = "   $rdel ";
 332+ $ldel = "   $ldel ";
 333+ }
 334+ // Don't show useless link to people who cannot hide revisions
 335+ if( $canHide || ($this->mNewRev->getVisibility() && $wgUser->isAllowed('deletedhistory')) ) {
 336+ if( !$this->mNewRev->userCan( Revision::DELETED_RESTRICTED ) ) {
 337+ $rdel = $sk->revDeleteLinkDisabled( $canHide ); // revision was hidden from sysops
 338+ } else {
 339+ $query = array(
 340+ 'type' => 'revision',
 341+ 'target' => $this->mNewRev->mTitle->getPrefixedDbkey(),
 342+ 'ids' => $this->mNewRev->getId()
 343+ );
 344+ $rdel = $sk->revDeleteLink( $query,
 345+ $this->mNewRev->isDeleted( Revision::DELETED_RESTRICTED ), $canHide );
349346 }
 347+ $rdel = "   $rdel ";
350348 }
351349
352350 $oldHeader = '<div id="mw-diff-otitle1"><strong>'.$this->mOldtitle.'</strong></div>' .
Index: trunk/phase3/includes/Article.php
@@ -3456,11 +3456,10 @@
34573457
34583458 $cdel = '';
34593459 // User can delete revisions or view deleted revisions...
3460 - $canHide = $wgUser->isAllowed('deleterevision');
 3460+ $canHide = $wgUser->isAllowed( 'deleterevision' );
34613461 if( $canHide || ($revision->getVisibility() && $wgUser->isAllowed('deletedhistory')) ) {
3462 - // Is this hidden from Sysops?
34633462 if( !$revision->userCan( Revision::DELETED_RESTRICTED ) ) {
3464 - $cdel = $sk->revDeleteLinkDisabled( $canHide );
 3463+ $cdel = $sk->revDeleteLinkDisabled( $canHide ); // rev was hidden from Sysops
34653464 } else {
34663465 $query = array(
34673466 'type' => 'revision',

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r58351* bug 21267 change "show/hide" to "show", if user cannot submit Special:Revis...aaron02:14, 30 October 2009

Comments

#Comment by Tim Starling (talk | contribs)   03:49, 5 January 2010

This code duplication needs to be fixed. Those two code blocks are exactly the same except for the different title.

#Comment by Aaron Schulz (talk | contribs)   21:36, 11 January 2010

Changed in r60945.

Status & tagging log