r56359 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r56358‎ | r56359 | r56360 >
Date:12:51, 15 September 2009
Author:werdna
Status:deferred
Tags:
Comment:
Fix for bug 20645, ensure that LQT notifications are sent in the user's language, not the language of the person who wrote the message.
Modified paths:
  • /trunk/extensions/LiquidThreads/classes/NewMessagesController.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/classes/NewMessagesController.php
@@ -225,9 +225,9 @@
226226
227227 while( $row = $dbr->fetchObject( $res ) ) {
228228 $u = User::newFromRow( $row );
 229+ $lang = Language::factory( $u->getOption( 'language' ) );
 230+ $langCode = $lang->getCode();
229231
230 - global $wgLang;
231 -
232232 $permalink = LqtView::permalinkUrl( $t );
233233
234234 // Adjust with time correction
@@ -237,20 +237,26 @@
238238 } else {
239239 $timeCorrection = $row->up_value;
240240 }
241 - $adjustedTimestamp = $wgLang->userAdjust( $timestamp, $timeCorrection );
 241+ $adjustedTimestamp = $lang->userAdjust( $timestamp, $timeCorrection );
242242
243 - $date = $wgLang->date( $adjustedTimestamp );
244 - $time = $wgLang->time( $adjustedTimestamp );
 243+ $date = $lang->date( $adjustedTimestamp );
 244+ $time = $lang->time( $adjustedTimestamp );
245245
246246 $talkPage = $t->article()->getTitle()->getPrefixedText();
247 - $msg = wfMsg( $msgName, $u->getName(), $t->subjectWithoutIncrement(),
 247+ $params = array( $u->getName(), $t->subjectWithoutIncrement(),
248248 $date, $time, $talkPage, $permalink );
 249+
 250+ // Get message in user's own language, bug 20645
 251+ $msg = wfMsgReal( $msgName, $params, true /* use DB */, $langCode,
 252+ true /*transform*/ );
249253
250254 global $wgPasswordSender;
251255
252256 $from = new MailAddress( $wgPasswordSender, 'WikiAdmin' );
253257 $to = new MailAddress( $u );
254 - $subject = wfMsgExt( $subjectMsg, 'parsemag', $t->subjectWithoutIncrement() );
 258+ $threadSubject = $t->subject();
 259+ $subject = wfMsgReal( $subjectMsg, array($threadSubject), true /* use DB */,
 260+ $langCode, true /* transform */);
255261
256262 UserMailer::send( $to, $from, $subject, $msg );
257263 }

Status & tagging log