Follow-up r56441: the cancel link now links to the correct version even on preview
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Fri, 5 Feb 2010 15:01:07 +0000 (15:01 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Fri, 5 Feb 2010 15:01:07 +0000 (15:01 +0000)
includes/EditPage.php

index 61273b1..ad9c993 100644 (file)
@@ -1344,6 +1344,8 @@ HTML
                $autosumm = $this->autoSumm ? $this->autoSumm : md5( $this->summary );
                $wgOut->addHTML( Xml::hidden( 'wpAutoSummary', $autosumm ) );
 
+               $wgOut->addHTML( Xml::hidden( 'oldid', $this->mArticle->getOldID() ) );
+
                if ( $this->section == 'new' ) {
                        $this->showSummaryInput( true, $this->summary );
                        $wgOut->addHTML( $this->getSummaryPreview( true, $this->summary ) );
@@ -2445,11 +2447,12 @@ INPUTS
 
        public function getCancelLink() {
                global $wgUser, $wgTitle;
+
                $cancelParams = array();
-               if ( !$this->isConflict && isset( $this->mArticle ) &&
-                       isset( $this->mArticle->mRevision ) &&
-                       !$this->mArticle->mRevision->isCurrent() )
-                               $cancelParams['oldid'] = $this->mArticle->mRevision->getId();
+               if ( !$this->isConflict && $this->mArticle->getOldID() > 0 ) {
+                       $cancelParams['oldid'] = $this->mArticle->getOldID();
+               }
+
                return $wgUser->getSkin()->link(
                        $wgTitle,
                        wfMsgExt( 'cancel', array( 'parseinline' ) ),