Merge "Adding comments and fixing some incorrect comments"

This commit is contained in:
Alex Monk 2012-11-28 18:23:37 +00:00 committed by Gerrit Code Review
commit 421babd44b
5 changed files with 17 additions and 8 deletions

View file

@ -175,9 +175,10 @@ class EchoNotificationController {
*
* @param $event EchoEvent that the notification is for.
* @param $user User to format the notification for.
* @param $format string The format to show the notification in: text or html
* @param $format string The format to show the notification in: text, html, or email
* @param $type string The type of notification being distributed (e.g. email, notify)
* @return string type description
* @return string|array The formatted notification, or an array of subject
* and body (for emails), or an error message
*/
public static function formatNotification( $event, $user, $format = 'text', $type = 'notify' ) {
global $wgEchoNotificationFormatters;

View file

@ -70,9 +70,11 @@ class EchoBasicFormatter extends EchoNotificationFormatter {
}
/**
* @param $event EchoEvent
* @param $user User
* @param $type string
* Formats a notification
*
* @param $event EchoEvent that the notification is for.
* @param $user User to format the notification for.
* @param $type string The type of notification being distributed (e.g. email, notify)
* @return array|string
*/
public function format( $event, $user, $type ) {
@ -84,9 +86,13 @@ class EchoBasicFormatter extends EchoNotificationFormatter {
return $this->formatNotificationTitle( $event, $user )->text();
}
// Assume html
// Assume html as the format for the notification
// Build the notification title
$title = $this->formatNotificationTitle( $event, $user )->parse();
$output = Xml::tags( 'div', array( 'class' => 'mw-echo-title' ), $title ) . "\n";
// Build the notification content
if ( !is_null( $this->content ) ) {
$content = $this->formatContent( $event, $user );
$content .= ' ' . $this->formatTimestamp( $event->getTimestamp(), $user );
@ -96,6 +102,7 @@ class EchoBasicFormatter extends EchoNotificationFormatter {
$output .= Xml::tags( 'div', array( 'class' => 'mw-echo-content' ), $content ) . "\n";
}
// Add the notification icon
if ( !is_null( $this->icon ) ) {
$output = Xml::tags( 'div',
array( 'class' => "mw-echo-icon mw-echo-icon-{$this->icon}" ),

View file

@ -46,7 +46,7 @@ abstract class EchoNotificationFormatter {
/**
* Set the output format that the notification will be displayed in.
*
* @param $format string A valid output format (by default, 'text' and 'html' are allowed)
* @param $format string A valid output format (by default, 'text', 'html', and 'email' are allowed)
* @throws MWException
*/
public function setOutputFormat( $format ) {

View file

@ -52,7 +52,7 @@ class EchoNotification {
}
/**
* Adds this new object to the database.
* Adds this new notification object to the database.
*/
protected function insert() {
$dbw = wfGetDB( DB_MASTER );

View file

@ -45,6 +45,7 @@ class SpecialNotifications extends SpecialPage {
$event = EchoEvent::newFromRow( $row );
$class = 'mw-echo-notification';
// Retrieve the formatted notification to display
$formatted = EchoNotificationController::formatNotification( $event, $user, 'html' );
if ( $row->notification_read_timestamp === null ) {