Legoktm has uploaded a new change for review.
https://gerrit.wikimedia.org/r/248902
Change subject: Don't use $wgLang in DataOutputFormatter
......................................................................
Don't use $wgLang in DataOutputFormatter
Require callers to pass it in.
Change-Id: I94ec940495a681151b289294186121462d4b5b5c
---
M includes/DataOutputFormatter.php
M includes/api/ApiEchoNotifications.php
M includes/special/SpecialNotifications.php
3 files changed, 9 insertions(+), 9 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo
refs/changes/02/248902/1
diff --git a/includes/DataOutputFormatter.php b/includes/DataOutputFormatter.php
index bee304e..1230c1a 100644
--- a/includes/DataOutputFormatter.php
+++ b/includes/DataOutputFormatter.php
@@ -18,9 +18,10 @@
* @param EchoNotification $notification
* @param string|bool $format specifify output format, false to not
format any notifications
* @param User $user the target user viewing the notification
+ * @param Language $lang Language to format the notification in
* @return array
*/
- public static function formatOutput( EchoNotification $notification,
$format = false, User $user ) {
+ public static function formatOutput( EchoNotification $notification,
$format = false, User $user, Language $lang ) {
$event = $notification->getEvent();
$timestamp = $notification->getTimestamp();
$utcTimestampUnix = wfTimestamp( TS_UNIX, $timestamp );
@@ -108,21 +109,18 @@
}
if ( $format ) {
- $output['*'] = self::formatNotification( $event, $user,
$format );
+ $output['*'] = self::formatNotification( $event, $user,
$format, $lang );
}
return $output;
}
- protected static function formatNotification( EchoEvent $event, User
$user, $format ) {
- global $wgLang;
+ protected static function formatNotification( EchoEvent $event, User
$user, $format, $lang ) {
if ( isset( self::$formatters[$format] )
&&
EchoEventPresentationModel::supportsPresentationModel( $event->getType() )
) {
- // FIXME don't use $wgLang. It's ok because this is
only used for the API or Special page, and not
- // emails yet.
/** @var EchoEventFormatter $formatter */
- $formatter = new self::$formatters[$format]( $user,
$wgLang );
+ $formatter = new self::$formatters[$format]( $user,
$lang );
return $formatter->format( $event );
} else {
// Legacy b/c
diff --git a/includes/api/ApiEchoNotifications.php
b/includes/api/ApiEchoNotifications.php
index db2b03c..6e7393a 100644
--- a/includes/api/ApiEchoNotifications.php
+++ b/includes/api/ApiEchoNotifications.php
@@ -146,7 +146,9 @@
wfProfileIn( __METHOD__ . '-formatting' );
foreach ( $notifs as $notif ) {
- $result['list'][$notif->getEvent()->getID()] =
EchoDataOutputFormatter::formatOutput( $notif, $format, $user );
+ $result['list'][$notif->getEvent()->getID()] =
EchoDataOutputFormatter::formatOutput(
+ $notif, $format, $user, $this->getLanguage()
+ );
}
wfProfileOut( __METHOD__ . '-formatting' );
diff --git a/includes/special/SpecialNotifications.php
b/includes/special/SpecialNotifications.php
index 60e344f..51c18fe 100644
--- a/includes/special/SpecialNotifications.php
+++ b/includes/special/SpecialNotifications.php
@@ -51,7 +51,7 @@
$attributeManager->getUserEnabledEvents( $user, 'web' )
);
foreach ( $notifications as $notification ) {
- $notif[] = EchoDataOutputFormatter::formatOutput(
$notification, 'html', $user );
+ $notif[] = EchoDataOutputFormatter::formatOutput(
$notification, 'html', $user, $this->getLanguage() );
}
// If there are no notifications, display a message saying so
--
To view, visit https://gerrit.wikimedia.org/r/248902
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I94ec940495a681151b289294186121462d4b5b5c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits