* (bug 10805) Fix "undo" link when viewing the diff of the most recent change to...
authorRob Church <robchurch@users.mediawiki.org>
Sat, 4 Aug 2007 19:15:18 +0000 (19:15 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Sat, 4 Aug 2007 19:15:18 +0000 (19:15 +0000)
* DifferenceEngine::loadRevisionData() wasn't updating $mNewid when loading the newer revision, which doesn't make too much sense if it ends up left as 0 (which is impossible)

RELEASE-NOTES
includes/DifferenceEngine.php

index 3132897..b491594 100644 (file)
@@ -352,6 +352,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Fixed regression in blocking of username '0'
 * (bug 9437) Don't overwrite edit form submission handler when setting up
   edit box scroll position preserve/restore behaviour
+* (bug 10805) Fix "undo" link when viewing the diff of the most recent
+  change to a page using "diff=0"
 
 == API changes since 1.10 ==
 
index fbfab34..1deabe8 100644 (file)
@@ -558,16 +558,15 @@ CONTROL;
                }
 
                // Load the new revision object
-               if( $this->mNewid ) {
-                       $this->mNewRev = Revision::newFromId( $this->mNewid );
-               } else {
-                       $this->mNewRev = Revision::newFromTitle( $this->mTitle );
-               }
-
-               if( is_null( $this->mNewRev ) ) {
+               $this->mNewRev = $this->mNewid
+                       ? Revision::newFromId( $this->mNewid )
+                       : Revision::newFromTitle( $this->mTitle );
+               if( !$this->mNewRev instanceof Revision )
                        return false;
-               }
-
+               
+               // Update the new revision ID in case it was 0 (makes life easier doing UI stuff)
+               $this->mNewid = $this->mNewRev->getId();
+               
                // Set assorted variables
                $timestamp = $wgLang->timeanddate( $this->mNewRev->getTimestamp(), true );
                $this->mNewPage = $this->mNewRev->getTitle();
@@ -616,7 +615,8 @@ CONTROL;
                        $oldEdit = $this->mOldPage->escapeLocalUrl( 'action=edit&oldid=' . $this->mOldid );
                        $this->mOldtitle = "<a href='$oldLink'>" . htmlspecialchars( wfMsg( 'revisionasof', $t ) )
                                . "</a> (<a href='$oldEdit'>" . htmlspecialchars( wfMsg( 'editold' ) ) . "</a>)";
-                       //now that we considered old rev, we can make undo link (bug 8133, multi-edit undo)
+                       
+                       // Add an "undo" link
                        $newUndo = $this->mNewPage->escapeLocalUrl( 'action=edit&undoafter=' . $this->mOldid . '&undo=' . $this->mNewid);
                        $this->mNewtitle .= " (<a href='$newUndo'>" . htmlspecialchars( wfMsg( 'editundo' ) ) . "</a>)";
                }