[Regression] Do not trim spaces on edit preview or show changes
authorumherirrender <umherirrender_de.wp@web.de>
Sun, 17 Feb 2013 13:39:04 +0000 (14:39 +0100)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 18 Feb 2013 07:28:59 +0000 (07:28 +0000)
Since Ic05e5898 spaces are also trimmed on preview/show changes, which
is bad, because the autosummary "/* Header */ " gets trimmed and the
user text is direct written behind the slash. That is confusing and was
not so, before this change.

Force the trim on summary preview to have the right preview, because the
spaces are trimmed on save.

Change-Id: I0058ce31197f3ea8ffc5520f3f0f9e1bf6105066

includes/EditPage.php

index 4e3ea49..5434dab 100644 (file)
@@ -624,11 +624,8 @@ class EditPage {
                                wfProfileOut( get_class( $this ) . "::importContentFormData" );
                        }
 
-                       # Trim spaces on user supplied text
-                       $summary = trim( $request->getText( 'wpSummary' ) );
-
                        # Truncate for whole multibyte characters
-                       $this->summary = $wgContLang->truncate( $summary, 255 );
+                       $this->summary = $wgContLang->truncate( $request->getText( 'wpSummary' ), 255 );
 
                        # If the summary consists of a heading, e.g. '==Foobar==', extract the title from the
                        # header syntax, e.g. 'Foobar'. This is mainly an issue when we are using wpSummary for
@@ -2453,6 +2450,8 @@ class EditPage {
         * @return String
         */
        protected function getSummaryPreview( $isSubjectPreview, $summary = "" ) {
+               // avoid spaces in preview, gets always trimmed on save
+               $summary = trim( $summary );
                if ( !$summary || ( !$this->preview && !$this->diff ) ) {
                        return "";
                }