2015-10-28 07:23:38 +00:00
|
|
|
<?php
|
2016-02-08 17:45:35 +00:00
|
|
|
|
|
|
|
class EchoFlowThanksPresentationModel extends Flow\FlowPresentationModel {
|
2015-10-28 07:23:38 +00:00
|
|
|
public function canRender() {
|
|
|
|
return (bool)$this->event->getTitle();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getIconType() {
|
|
|
|
return 'thanks';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getHeaderMessage() {
|
2016-06-16 16:12:38 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
2015-10-28 07:23:38 +00:00
|
|
|
|
2016-06-16 16:12:38 +00:00
|
|
|
public function getCompactHeaderMessage() {
|
|
|
|
$msg = parent::getCompactHeaderMessage();
|
2015-11-13 00:03:55 +00:00
|
|
|
$msg->params( $this->getViewingUserForGender() );
|
2015-10-28 07:23:38 +00:00
|
|
|
return $msg;
|
|
|
|
}
|
|
|
|
|
2016-06-16 16:12:38 +00:00
|
|
|
public function getBodyMessage() {
|
|
|
|
$excerpt = $this->event->getExtraParam( 'excerpt' );
|
|
|
|
if ( $excerpt ) {
|
|
|
|
$msg = new RawMessage( '$1' );
|
|
|
|
$msg->plaintextParams( $excerpt );
|
|
|
|
return $msg;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-28 07:23:38 +00:00
|
|
|
public function getPrimaryLink() {
|
2017-04-26 01:08:02 +00:00
|
|
|
$title = Title::makeTitleSafe( NS_TOPIC, $this->event->getExtraParam( 'workflow' ) );
|
|
|
|
if ( !$title ) {
|
|
|
|
// Workflow IDs that are invalid titles should never happen; we can try
|
|
|
|
// falling back on the page title and hope the #flow-post- anchor will be there.
|
|
|
|
$title = $this->event->getTitle();
|
|
|
|
}
|
2015-10-28 07:23:38 +00:00
|
|
|
// Make a link to #flow-post-{postid}
|
2017-09-10 22:24:38 +00:00
|
|
|
$title = $title->createFragmentTarget( 'flow-post-' . $this->event->getExtraParam( 'post-id' ) );
|
2015-10-28 07:23:38 +00:00
|
|
|
|
2016-04-22 20:13:56 +00:00
|
|
|
return [
|
2017-04-26 01:08:02 +00:00
|
|
|
'url' => $title->getFullURL(),
|
2016-01-12 21:45:42 +00:00
|
|
|
'label' => $this->msg( 'notification-link-text-view-post' )->text(),
|
2016-04-22 20:13:56 +00:00
|
|
|
];
|
2015-10-28 07:23:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getSecondaryLinks() {
|
2016-06-16 16:12:38 +00:00
|
|
|
if ( $this->isBundled() ) {
|
|
|
|
return [ $this->getBoardLink() ];
|
|
|
|
} else {
|
|
|
|
return [ $this->getAgentLink(), $this->getBoardLink() ];
|
|
|
|
}
|
2015-10-28 07:23:38 +00:00
|
|
|
}
|
|
|
|
}
|