Index: trunk/phase3/includes/diff/DifferenceInterface.php |
— | — | @@ -312,47 +312,21 @@ |
313 | 313 | $newminor = ChangesList::flag( 'minor' ); |
314 | 314 | } |
315 | 315 | |
316 | | - $rdel = $ldel = ''; |
317 | 316 | # Handle RevisionDelete links... |
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 ); |
331 | | - } |
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 ); |
346 | | - } |
347 | | - $rdel = " $rdel "; |
348 | | - } |
| 317 | + $ldel = $this->revisionDeleteLink( $this->mOldRev ); |
| 318 | + $rdel = $this->revisionDeleteLink( $this->mNewRev ); |
349 | 319 | |
350 | 320 | $oldHeader = '<div id="mw-diff-otitle1"><strong>'.$this->mOldtitle.'</strong></div>' . |
351 | | - '<div id="mw-diff-otitle2">' . $sk->revUserTools( $this->mOldRev, !$this->unhide ) . "</div>" . |
352 | | - '<div id="mw-diff-otitle3">' . $oldminor . $sk->revComment( $this->mOldRev, !$diffOnly, !$this->unhide ).$ldel."</div>" . |
| 321 | + '<div id="mw-diff-otitle2">' . |
| 322 | + $sk->revUserTools( $this->mOldRev, !$this->unhide ).'</div>' . |
| 323 | + '<div id="mw-diff-otitle3">' . $oldminor . |
| 324 | + $sk->revComment( $this->mOldRev, !$diffOnly, !$this->unhide ).$ldel.'</div>' . |
353 | 325 | '<div id="mw-diff-otitle4">' . $prevlink .'</div>'; |
354 | 326 | $newHeader = '<div id="mw-diff-ntitle1"><strong>'.$this->mNewtitle.'</strong></div>' . |
355 | | - '<div id="mw-diff-ntitle2">' . $sk->revUserTools( $this->mNewRev, !$this->unhide ) . " $rollback</div>" . |
356 | | - '<div id="mw-diff-ntitle3">' . $newminor . $sk->revComment( $this->mNewRev, !$diffOnly, !$this->unhide ).$rdel."</div>" . |
| 327 | + '<div id="mw-diff-ntitle2">' . $sk->revUserTools( $this->mNewRev, !$this->unhide ) . |
| 328 | + " $rollback</div>" . |
| 329 | + '<div id="mw-diff-ntitle3">' . $newminor . |
| 330 | + $sk->revComment( $this->mNewRev, !$diffOnly, !$this->unhide ).$rdel.'</div>' . |
357 | 331 | '<div id="mw-diff-ntitle4">' . $nextlink . $patrol . '</div>'; |
358 | 332 | |
359 | 333 | # Check if this user can see the revisions |
— | — | @@ -406,6 +380,31 @@ |
407 | 381 | } |
408 | 382 | wfProfileOut( __METHOD__ ); |
409 | 383 | } |
| 384 | + |
| 385 | + protected function revisionDeleteLink( $rev ) { |
| 386 | + global $wgUser; |
| 387 | + $link = ''; |
| 388 | + $canHide = $wgUser->isAllowed( 'deleterevision' ); |
| 389 | + // Show del/undel link if: |
| 390 | + // (a) the user can delete revisions, or |
| 391 | + // (b) the user can view deleted revision *and* this one is deleted |
| 392 | + if( $canHide || ($rev->getVisibility() && $wgUser->isAllowed( 'deletedhistory' )) ) { |
| 393 | + $sk = $wgUser->getSkin(); |
| 394 | + if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) { |
| 395 | + $link = $sk->revDeleteLinkDisabled( $canHide ); // revision was hidden from sysops |
| 396 | + } else { |
| 397 | + $query = array( |
| 398 | + 'type' => 'revision', |
| 399 | + 'target' => $this->mOldRev->mTitle->getPrefixedDbkey(), |
| 400 | + 'ids' => $this->mOldRev->getId() |
| 401 | + ); |
| 402 | + $link = $sk->revDeleteLink( $query, |
| 403 | + $rev->isDeleted( Revision::DELETED_RESTRICTED ), $canHide ); |
| 404 | + } |
| 405 | + $link = '  '.$link.' '; |
| 406 | + } |
| 407 | + return $link; |
| 408 | + } |
410 | 409 | |
411 | 410 | /** |
412 | 411 | * Show the new revision of the page. |