Improve diff behavoir for rev_deleted a tad; first commit, don't stab please :).
authorAaron Schulz <aaron@users.mediawiki.org>
Sun, 4 Feb 2007 05:07:46 +0000 (05:07 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Sun, 4 Feb 2007 05:07:46 +0000 (05:07 +0000)
includes/DifferenceEngine.php

index d218917..89caa1e 100644 (file)
@@ -201,6 +201,10 @@ CONTROL;
                wfProfileIn( $fname );
 
                $wgOut->addHTML( "<hr /><h2>{$this->mPagetitle}</h2>\n" );
+               #add deleted rev tag if needed
+               if ( !$this->mNewRev->userCan(Revision::DELETED_TEXT) ) {
+                       $wgOut->addWikiText( wfMsg( 'rev-deleted-text-permission' ) );
+               }
 
                if( !$this->mNewRev->isCurrent() ) {
                        $oldEditSectionSetting = $wgOut->parserOptions()->setEditSection( false );
@@ -328,9 +332,12 @@ CONTROL;
                        }
                }
 
+               #loadtext is permission safe, this just clears out the diff
                if ( !$this->loadText() ) {
                        wfProfileOut( $fname );
                        return false;
+               } else if ( !$this->mOldRev->userCan(Revision::DELETED_TEXT) || !$this->mNewRev->userCan(Revision::DELETED_TEXT) ) {
+                 return '';
                }
 
                $difftext = $this->generateDiffBody( $this->mOldtext, $this->mNewtext );
@@ -469,6 +476,13 @@ CONTROL;
         * Add the header to a diff body
         */
        function addHeader( $diff, $otitle, $ntitle, $multi = '' ) {
+               global $wgOut;
+       
+               if ( !$this->mOldRev->userCan(Revision::DELETED_TEXT) ) {
+                 $otitle = '<span class="history-deleted">'.$otitle.'</span>';
+               } else if ( !$this->mNewRev->userCan(Revision::DELETED_TEXT) ) {
+                 $ntitle = '<span class="history-deleted">'.$ntitle.'</span>';
+               }
                $header = "
                        <table border='0' width='98%' cellpadding='0' cellspacing='4' class='diff'>
                        <tr>