mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-28 01:30:15 +00:00
cb1051ce19
It always puzzles and confuses me when I get this notification without the namespace. Change-Id: I03711575d8ddbdfb07879982640dfdcb7b69b3ab
60 lines
1.4 KiB
PHP
60 lines
1.4 KiB
PHP
<?php
|
|
|
|
class EchoMentionInSummaryPresentationModel extends EchoEventPresentationModel {
|
|
|
|
public function getIconType() {
|
|
return 'mention';
|
|
}
|
|
|
|
public function canRender() {
|
|
return (bool)$this->event->getTitle();
|
|
}
|
|
|
|
public function getHeaderMessage() {
|
|
$msg = $this->getMessageWithAgent( 'notification-header-mention-summary' );
|
|
$msg->params( $this->getViewingUserForGender() );
|
|
$msg->params( $this->getTruncatedTitleText( $this->event->getTitle(), true ) );
|
|
|
|
return $msg;
|
|
}
|
|
|
|
public function getBodyMessage() {
|
|
if ( $this->userCan( Revision::DELETED_COMMENT ) ) {
|
|
$revision = $this->event->getRevision();
|
|
$summary = $revision->getComment();
|
|
$summary = Linker::formatComment( $summary );
|
|
$summary = Sanitizer::stripAllTags( $summary );
|
|
|
|
$msg = $this->msg( 'notification-body-mention' )
|
|
->plaintextParams( $summary );
|
|
return $msg;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public function getPrimaryLink() {
|
|
return [
|
|
'url' => $this->getDiffURL(),
|
|
'label' => $this->msg( 'notification-link-text-view-changes', $this->getViewingUserForGender() )->text(),
|
|
];
|
|
}
|
|
|
|
public function getSecondaryLinks() {
|
|
return [ $this->getAgentLink() ];
|
|
}
|
|
|
|
protected function getSubjectMessageKey() {
|
|
return 'notification-mention-email-subject';
|
|
}
|
|
|
|
private function getDiffURL() {
|
|
$title = $this->event->getTitle();
|
|
|
|
return $title->getLocalURL( [
|
|
'oldid' => 'prev',
|
|
'diff' => $this->event->getExtraParam( 'revid' )
|
|
] );
|
|
}
|
|
}
|