From 9cc44a6aed735d3e73ce188ddff56f7821d6dc90 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 30 Jun 2005 06:51:43 +0000 Subject: [PATCH] * (bug 2618) Fix regression from another fix; show initial preview for categories only if the page does not exist. --- RELEASE-NOTES | 2 ++ includes/EditPage.php | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index cc6bcc65b4..7f537f30ae 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -427,6 +427,8 @@ Various bugfixes, small features, and a few experimental things: Also fix navigation links on current-with-oldid view. * (bug 2620) Return to prior behavior for some more things (such as subpage parent links) on current-diff view. +* (bug 2618) Fix regression from another fix; show initial preview for + categories only if the page does not exist. === Caveats === diff --git a/includes/EditPage.php b/includes/EditPage.php index 1b53ba1a77..a97558f73b 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -181,8 +181,7 @@ class EditPage { } else if ( $this->diff ) { $this->editForm( 'diff' ); } else { # First time through - if( $wgUser->getOption('previewonfirst') - or $this->mTitle->getNamespace() == NS_CATEGORY ) { + if( $this->previewOnOpen() ) { $this->editForm( 'preview', true ); } else { $this->extractMetaDataFromArticle () ; @@ -190,6 +189,19 @@ class EditPage { } } } + + /** + * Return true if this page should be previewed when the edit form + * is initially opened. + * @return bool + * @access private + */ + function previewOnOpen() { + global $wgUser; + return $wgUser->getOption( 'previewonfirst' ) || + ( $this->mTitle->getNamespace() == NS_CATEGORY && + !$this->mTitle->exists() ); + } /** * @todo document -- 2.20.1