Index: branches/wmf/1.17wmf1/extensions/NewUserMessage/NewUserMessage.i18n.php |
— | — | @@ -15,6 +15,7 @@ |
16 | 16 | $messages['en'] = array( |
17 | 17 | 'newusermessage-desc' => "Adds a message to newly created user's talk pages", |
18 | 18 | 'newuseredit-summary' => 'Adding [[{{int:newusermessage-template}}|welcome message]] to new user\'s talk page', |
| 19 | + 'newusermessage-template' => 'Template:Welcome', # The title of the message template |
19 | 20 | 'newusermessage-template-subject' => 'Template:Welcome-subject', # Always substituted. Used if LiquidThreads is enabled in the User_talk namespace. Do not translate or duplicate this message to other languages |
20 | 21 | 'newusermessage-template-body' => 'Template:Welcome-body', # Used if LiquidThreads is enabled in the User_talk namespace. Do not translate or duplicate this message to other languages |
21 | 22 | 'newusermessage-editor' => 'New user message', # The username used for the edit |
Index: branches/wmf/1.17wmf1/extensions/NewUserMessage/NewUserMessage.class.php |
— | — | @@ -83,7 +83,12 @@ |
84 | 84 | * @returns String |
85 | 85 | */ |
86 | 86 | static function fetchText() { |
87 | | - return self::fetchTemplateIfExists( wfMsg( 'newusermessage-template-body' ) ); |
| 87 | + $text = self::fetchTemplateIfExists( wfMsg( 'newusermessage-template-body' ) ); |
| 88 | + // Fall back if necessary to the old template |
| 89 | + if ( !$text ) { |
| 90 | + $text = self::fetchTemplateIfExists( wfMsg( 'newusermessage-template' ) ); |
| 91 | + } |
| 92 | + return $text; |
88 | 93 | } |
89 | 94 | |
90 | 95 | /** |
— | — | @@ -148,11 +153,17 @@ |
149 | 154 | $editor = self::fetchEditor(); |
150 | 155 | $flags = self::fetchFlags(); |
151 | 156 | |
152 | | - $subject = self::substString( $subject, $user, $editor, $talk, "preparse" ); |
153 | | - $text = self::substString( $text, $user, $editor, $talk ); |
| 157 | + if ( $subject ) { |
| 158 | + $subject = self::substString( $subject, $user, $editor, $talk, "preparse" ); |
| 159 | + } |
| 160 | + if ( $text ) { |
| 161 | + $text = self::substString( $text, $user, $editor, $talk ); |
| 162 | + } |
154 | 163 | |
155 | | - return self::leaveUserMessage( $user, $article, $subject, $text, |
| 164 | + self::leaveUserMessage( $user, $article, $subject, $text, |
156 | 165 | $signature, $editSummary, $editor, $flags ); |
| 166 | + |
| 167 | + return true; |
157 | 168 | } |
158 | 169 | } |
159 | 170 | |
— | — | @@ -195,7 +206,6 @@ |
196 | 207 | */ |
197 | 208 | public static function leaveUserMessage( $user, $article, $subject, $text, $signature, |
198 | 209 | $summary, $editor, $flags ) { |
199 | | - |
200 | 210 | $text = self::formatUserMessage( $subject, $text, $signature ); |
201 | 211 | $flags = $article->checkFlags( $flags ); |
202 | 212 | |
— | — | @@ -232,9 +242,14 @@ |
233 | 243 | * @param $signature String the signature, if provided. |
234 | 244 | */ |
235 | 245 | static protected function formatUserMessage( $subject, $text, $signature ) { |
236 | | - $signature = empty($signature) ? "~~~~~" : "{$signature} ~~~~~"; |
237 | | - $text = "\n== $subject ==\n\n$text\n\n-- $signature"; |
| 246 | + $contents = "\n"; |
| 247 | + $signature = empty( $signature ) ? "~~~~~" : "{$signature} ~~~~~"; |
| 248 | + |
| 249 | + if ( $subject ) { |
| 250 | + $contents .= "== $subject ==\n"; |
| 251 | + } |
| 252 | + $contents .= "\n$text\n\n-- $signature\n"; |
238 | 253 | |
239 | | - return $text; |
| 254 | + return $contents; |
240 | 255 | } |
241 | 256 | } |
Property changes on: branches/wmf/1.17wmf1/extensions/NewUserMessage |
___________________________________________________________________ |
Added: svn:mergeinfo |
242 | 257 | Merged /branches/sqlite/extensions/NewUserMessage:r58211-58321 |
243 | 258 | Merged /trunk/phase3/extensions/NewUserMessage:r79828,79830,79848,79853,79950-79951,79954,79989,80006-80007,80013,80016,80080,80083,80124,80128,80238,81833 |
244 | 259 | Merged /branches/new-installer/phase3/extensions/NewUserMessage:r43664-66004 |
245 | 260 | Merged /branches/wmf-deployment/extensions/NewUserMessage:r60970 |
246 | 261 | Merged /branches/REL1_15/phase3/extensions/NewUserMessage:r51646 |
247 | 262 | Merged /branches/wmf/1.16wmf4/extensions/NewUserMessage:r67177,69199,76243,77266 |
248 | 263 | Merged /trunk/extensions/NewUserMessage:r81966,81969 |