mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Thanks
synced 2024-11-15 19:09:52 +00:00
b52fd0ea6f
* edit-thank * flow-thank Bug: T120152 Depends-On: I1507cae360f45cc87f2d60e966b4d047abfa202d Depends-On: I91abb2dded9ab7f124aaa798dd07c52576ee791b Change-Id: I21e36d1874967495d9541f621481cfccf54b7f19
68 lines
1.7 KiB
PHP
68 lines
1.7 KiB
PHP
<?php
|
|
|
|
class EchoFlowThanksPresentationModel extends Flow\FlowPresentationModel {
|
|
public function canRender() {
|
|
return (bool)$this->event->getTitle();
|
|
}
|
|
|
|
public function getIconType() {
|
|
return 'thanks';
|
|
}
|
|
|
|
public function getHeaderMessage() {
|
|
if ( $this->isBundled() ) {
|
|
$msg = $this->msg( 'notification-bundle-header-flow-thank' );
|
|
$msg->params( $this->getBundleCount() );
|
|
$msg->plaintextParams( $this->getTopicTitle() );
|
|
$msg->params( $this->getViewingUserForGender() );
|
|
return $msg;
|
|
} else {
|
|
$msg = parent::getHeaderMessage();
|
|
$msg->plaintextParams( $this->getTopicTitle() );
|
|
$msg->params( $this->getTruncatedTitleText( $this->event->getTitle(), true ) );
|
|
$msg->params( $this->getViewingUserForGender() );
|
|
return $msg;
|
|
}
|
|
}
|
|
|
|
public function getCompactHeaderMessage() {
|
|
$msg = parent::getCompactHeaderMessage();
|
|
$msg->params( $this->getViewingUserForGender() );
|
|
return $msg;
|
|
}
|
|
|
|
public function getBodyMessage() {
|
|
$excerpt = $this->event->getExtraParam( 'excerpt' );
|
|
if ( $excerpt ) {
|
|
$msg = new RawMessage( '$1' );
|
|
$msg->plaintextParams( $excerpt );
|
|
return $msg;
|
|
}
|
|
}
|
|
|
|
public function getPrimaryLink() {
|
|
$title = $this->event->getTitle();
|
|
// Make a link to #flow-post-{postid}
|
|
$title = Title::makeTitle(
|
|
$title->getNamespace(),
|
|
$title->getDBKey(),
|
|
'flow-post-' . $this->event->getExtraParam( 'post-id' )
|
|
);
|
|
|
|
return [
|
|
'url' => $title->getFullURL( [
|
|
'workflow' => $this->event->getExtraParam( 'workflow' )
|
|
] ),
|
|
'label' => $this->msg( 'notification-link-text-view-post' )->text(),
|
|
];
|
|
}
|
|
|
|
public function getSecondaryLinks() {
|
|
if ( $this->isBundled() ) {
|
|
return [ $this->getBoardLink() ];
|
|
} else {
|
|
return [ $this->getAgentLink(), $this->getBoardLink() ];
|
|
}
|
|
}
|
|
}
|