mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-23 23:44:53 +00:00
formatters: Minor cleanup
* Fix some indenting * Remove some unnecessary temporary variables Change-Id: I2330238a090b7f5ccd14d8e44aeaff10d731352e
This commit is contained in:
parent
f74cee0b4f
commit
bd062137bb
|
@ -18,18 +18,18 @@ class EchoFlyoutFormatter extends EchoEventFormatter {
|
|||
);
|
||||
|
||||
$html = Xml::tags(
|
||||
'div',
|
||||
[ 'class' => 'mw-echo-title' ],
|
||||
$model->getHeaderMessage()->parse()
|
||||
) . "\n";
|
||||
'div',
|
||||
[ 'class' => 'mw-echo-title' ],
|
||||
$model->getHeaderMessage()->parse()
|
||||
) . "\n";
|
||||
|
||||
$body = $model->getBodyMessage();
|
||||
if ( $body ) {
|
||||
$html .= Xml::tags(
|
||||
'div',
|
||||
[ 'class' => 'mw-echo-payload' ],
|
||||
$body->parse()
|
||||
) . "\n";
|
||||
'div',
|
||||
[ 'class' => 'mw-echo-payload' ],
|
||||
$body->parse()
|
||||
) . "\n";
|
||||
}
|
||||
|
||||
$ts = $this->language->getHumanTimestamp(
|
||||
|
@ -63,15 +63,13 @@ class EchoFlyoutFormatter extends EchoEventFormatter {
|
|||
$html = Xml::tags( 'div', [ 'class' => 'mw-echo-content' ], $html );
|
||||
|
||||
// And then add the icon in front and wrap with mw-echo-state class.
|
||||
$html = Xml::tags( 'div', [ 'class' => 'mw-echo-state' ], $icon . $html );
|
||||
|
||||
return $html;
|
||||
return Xml::tags( 'div', [ 'class' => 'mw-echo-state' ], $icon . $html );
|
||||
}
|
||||
|
||||
private function getIconURL( EchoEventPresentationModel $model ) {
|
||||
return EchoIcon::getUrl(
|
||||
$model->getIconType(),
|
||||
$this->language->getDir()
|
||||
$model->getIconType(),
|
||||
$this->language->getDir()
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -70,11 +70,11 @@ class EchoIcon {
|
|||
// rasterizing module
|
||||
if ( $url === false || $url === null ) {
|
||||
$iconUrl = wfScript( 'load' ) . '?' . wfArrayToCgi( [
|
||||
'modules' => 'ext.echo.emailicons',
|
||||
'image' => $icon,
|
||||
'lang' => $lang,
|
||||
'format' => 'rasterized'
|
||||
] );
|
||||
'modules' => 'ext.echo.emailicons',
|
||||
'image' => $icon,
|
||||
'lang' => $lang,
|
||||
'format' => 'rasterized'
|
||||
] );
|
||||
} else {
|
||||
// For icons that are defined by URL
|
||||
$iconUrl = $wgEchoNotificationIcons[ $icon ][ 'url' ];
|
||||
|
|
|
@ -111,9 +111,7 @@ class EchoEditUserTalkPresentationModel extends EchoEventPresentationModel {
|
|||
$revisionLookup = MediaWikiServices::getInstance()->getRevisionLookup();
|
||||
$revisionRecord = $revisionLookup->getRevisionById( $firstNotificationRevId );
|
||||
$previousRevision = $revisionRecord ? $revisionLookup->getPreviousRevision( $revisionRecord ) : null;
|
||||
$oldRevisionID = $previousRevision ? $previousRevision->getId() : 0;
|
||||
|
||||
return $oldRevisionID;
|
||||
return $previousRevision ? $previousRevision->getId() : 0;
|
||||
}
|
||||
|
||||
protected function getSubjectMessageKey() {
|
||||
|
|
|
@ -251,8 +251,7 @@ abstract class EchoEventPresentationModel implements JsonSerializable, MessageLo
|
|||
*/
|
||||
final protected function getNotificationCountForOutput( $includeCurrent = true, $groupCallback = null ) {
|
||||
$count = $this->getBundleCount( $includeCurrent, $groupCallback );
|
||||
$cappedCount = EchoNotificationController::getCappedNotificationCount( $count );
|
||||
return $cappedCount;
|
||||
return EchoNotificationController::getCappedNotificationCount( $count );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,9 +27,8 @@ class EchoMentionInSummaryPresentationModel extends EchoEventPresentationModel {
|
|||
$summary = Linker::formatComment( $summary );
|
||||
$summary = Sanitizer::stripAllTags( $summary );
|
||||
|
||||
$msg = $this->msg( 'notification-body-mention' )
|
||||
return $this->msg( 'notification-body-mention' )
|
||||
->plaintextParams( $summary );
|
||||
return $msg;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -51,9 +50,7 @@ class EchoMentionInSummaryPresentationModel extends EchoEventPresentationModel {
|
|||
}
|
||||
|
||||
private function getDiffURL() {
|
||||
$title = $this->event->getTitle();
|
||||
|
||||
return $title->getLocalURL( [
|
||||
return $this->event->getTitle()->getLocalURL( [
|
||||
'oldid' => 'prev',
|
||||
'diff' => $this->event->getExtraParam( 'revid' )
|
||||
] );
|
||||
|
|
|
@ -98,9 +98,7 @@ class EchoMentionPresentationModel extends EchoEventPresentationModel {
|
|||
}
|
||||
|
||||
public function getSecondaryLinks() {
|
||||
$title = $this->event->getTitle();
|
||||
|
||||
$url = $title->getLocalURL( [
|
||||
$url = $this->event->getTitle()->getLocalURL( [
|
||||
'oldid' => 'prev',
|
||||
'diff' => $this->event->getExtraParam( 'revid' )
|
||||
] );
|
||||
|
|
|
@ -40,18 +40,18 @@ class SpecialNotificationsFormatter extends EchoEventFormatter {
|
|||
);
|
||||
|
||||
$html = Xml::tags(
|
||||
'div',
|
||||
[ 'class' => 'mw-echo-title' ],
|
||||
$model->getHeaderMessage()->parse()
|
||||
) . "\n";
|
||||
'div',
|
||||
[ 'class' => 'mw-echo-title' ],
|
||||
$model->getHeaderMessage()->parse()
|
||||
) . "\n";
|
||||
|
||||
$body = $model->getBodyMessage();
|
||||
if ( $body ) {
|
||||
$html .= Xml::tags(
|
||||
'div',
|
||||
[ 'class' => 'mw-echo-payload' ],
|
||||
$body->escaped()
|
||||
) . "\n";
|
||||
'div',
|
||||
[ 'class' => 'mw-echo-payload' ],
|
||||
$body->escaped()
|
||||
) . "\n";
|
||||
}
|
||||
|
||||
$ts = $this->language->getHumanTimestamp(
|
||||
|
@ -102,15 +102,13 @@ class SpecialNotificationsFormatter extends EchoEventFormatter {
|
|||
// And then add the mark as read button
|
||||
// and the icon in front and wrap with
|
||||
// mw-echo-state class.
|
||||
$html = Xml::tags( 'div', [ 'class' => 'mw-echo-state' ], $markAsReadButton . $icon . $html );
|
||||
|
||||
return $html;
|
||||
return Xml::tags( 'div', [ 'class' => 'mw-echo-state' ], $markAsReadButton . $icon . $html );
|
||||
}
|
||||
|
||||
private function getIconURL( EchoEventPresentationModel $model ) {
|
||||
return EchoIcon::getUrl(
|
||||
$model->getIconType(),
|
||||
$this->language->getDir()
|
||||
$model->getIconType(),
|
||||
$this->language->getDir()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue