From 18648488c412a8bb509e61e7e576b893ce5a8820 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Wed, 30 Nov 2011 14:51:07 +0000 Subject: [PATCH] )bug 15521) Use new section summary when the action of adding a new section also happens to create the page. Patch by Harry Burt --- includes/EditPage.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index 05374062e4..9584b3f5fa 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -867,7 +867,7 @@ class EditPage { case self::AS_SUCCESS_NEW_ARTICLE: $query = $resultDetails['redirect'] ? 'redirect=no' : ''; - $wgOut->redirect( $this->mTitle->getFullURL( $query ) ); + $wgOut->redirect( $this->mTitle->getFullURL( $query ) . $resultDetails['sectionanchor'] ); return false; case self::AS_SUCCESS_UPDATE: @@ -1112,8 +1112,17 @@ class EditPage { } $text = $this->textbox1; + $result['sectionanchor'] == ''; if ( $this->section == 'new' && $this->summary != '' ) { $text = wfMsgForContent( 'newsectionheaderdefaultlevel', $this->summary ) . "\n\n" . $text; + + # Jump to the new section + $result['sectionanchor'] = $wgParser->guessLegacySectionNameFromWikiText( $this->summary ); + + # This is a new section, so create a link to the new section + # in the revision summary. + $cleanSummary = $wgParser->stripSectionName( $this->summary ); + $this->summary = wfMsgForContent( 'newsectionsummary', $cleanSummary ); } $status->value = self::AS_SUCCESS_NEW_ARTICLE; -- 2.20.1