https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113352

Revision: 113352
Author:   krinkle
Date:     2012-03-08 09:46:57 +0000 (Thu, 08 Mar 2012)
Log Message:
-----------
[NewUserMessage] Don't prepend 2 empty lines before the Welcome template
* First line, meant to offset from potentially pre-existent content. Aside from 
the fact that the caller of this function only runs if !$talk->exists(), it 
could potentially exist later in a race condition (I've never seen this happen, 
but the code is already checking for that case where it prepends getRawText()), 
moved the first newline to there.
* Second line, meant to offset from the ==subject==, moved to within the if 
statement
 
* Fixes:
-- (bug 35058) [Regression] Don't prepend 2 empty lines before the Welcome 
template

Modified Paths:
--------------
    trunk/extensions/NewUserMessage/NewUserMessage.class.php

Modified: trunk/extensions/NewUserMessage/NewUserMessage.class.php
===================================================================
--- trunk/extensions/NewUserMessage/NewUserMessage.class.php    2012-03-08 
09:00:45 UTC (rev 113351)
+++ trunk/extensions/NewUserMessage/NewUserMessage.class.php    2012-03-08 
09:46:57 UTC (rev 113352)
@@ -153,6 +153,7 @@
        static function createNewUserMessage( $user ) {
                $talk = $user->getTalkPage();
 
+               // Only leave message if user doesn't have a talk page yet
                if ( !$talk->exists() ) {
                        $article = new Article( $talk );
                        $subject = self::fetchSubject();
@@ -223,7 +224,7 @@
                $flags = $article->checkFlags( $flags );
 
                if ( $flags & EDIT_UPDATE ) {
-                       $text = $article->getRawText() . $text;
+                       $text = $article->getRawText() . "\n" . $text;
                }
 
                $dbw = wfGetDB( DB_MASTER );
@@ -255,13 +256,13 @@
         * @param $signature String the signature, if provided.
         */
        static protected function formatUserMessage( $subject, $text, 
$signature ) {
-               $contents = "\n";
+               $contents = "";
                $signature = empty( $signature ) ? "~~~~" : "{$signature} 
~~~~~";
                
                if ( $subject ) {
-                       $contents .= "== $subject ==\n";
+                       $contents .= "== $subject ==\n\n";
                }
-               $contents .= "\n$text\n\n-- $signature\n";
+               $contents .= "$text\n\n-- $signature\n";
 
                return $contents;
        }


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to