From 528842e3a5fcab99bf123a83f60f9cb3b37b22a5 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 1 Jun 2005 08:18:34 +0000 Subject: [PATCH] * (bug 2053) Move comment whitespace trimming from edit page to save; leaves the whitespace from the section comment there on preview. --- RELEASE-NOTES | 2 ++ includes/EditPage.php | 2 +- includes/Revision.php | 6 ++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 30d06b2659..4529942300 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -233,6 +233,8 @@ Various bugfixes, small features, and a few experimental things: * Removed some obsolete UTF-8 converter functions * Fix function comment in debug dump of SQL statements * (bug 2275) Update search index more or less right on page move +* (bug 2053) Move comment whitespace trimming from edit page to save; + leaves the whitespace from the section comment there on preview. === Caveats === diff --git a/includes/EditPage.php b/includes/EditPage.php index 1aa9b3fd20..13b4615d71 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -197,7 +197,7 @@ class EditPage { $this->textbox1 = rtrim( $request->getText( 'wpTextbox1' ) ); $this->textbox2 = rtrim( $request->getText( 'wpTextbox2' ) ); $this->mMetaData = rtrim( $request->getText( 'metadata' ) ); - $this->summary = trim( $request->getText( 'wpSummary' ) ); + $this->summary = $request->getText( 'wpSummary' ); $this->edittime = $request->getVal( 'wpEdittime' ); if( is_null( $this->edittime ) ) { diff --git a/includes/Revision.php b/includes/Revision.php index b58d50c0af..cfe29f66d4 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -232,13 +232,15 @@ class Revision { $this->mId = isset( $row['id'] ) ? IntVal( $row['id'] ) : null; $this->mPage = isset( $row['page'] ) ? IntVal( $row['page'] ) : null; $this->mTextId = isset( $row['text_id'] ) ? IntVal( $row['text_id'] ) : null; - $this->mComment = isset( $row['comment'] ) ? StrVal( $row['comment'] ) : null; $this->mUserText = isset( $row['user_text'] ) ? StrVal( $row['user_text'] ) : $wgUser->getName(); $this->mUser = isset( $row['user'] ) ? IntVal( $row['user'] ) : $wgUser->getId(); $this->mMinorEdit = isset( $row['minor_edit'] ) ? IntVal( $row['minor_edit'] ) : 0; $this->mTimestamp = isset( $row['timestamp'] ) ? StrVal( $row['timestamp'] ) : wfTimestamp( TS_MW ); $this->mDeleted = isset( $row['deleted'] ) ? IntVal( $row['deleted'] ) : 0; - $this->mText = isset( $row['text'] ) ? StrVal( $row['text'] ) : null; + + // Enforce spacing trimming on supplied text + $this->mComment = isset( $row['comment'] ) ? trim( StrVal( $row['comment'] ) ) : null; + $this->mText = isset( $row['text'] ) ? rtrim( StrVal( $row['text'] ) ) : null; $this->mTitle = null; # Load on demand if needed $this->mCurrent = false; -- 2.20.1