mediawiki-extensions-Thanks/FlowThanksPresentationModel.php
Roan Kattouw fb846d54b0 Add the agent as a secondary link to Thanks notifications
Change-Id: I7d1ed933b23d7b0e69099fa373853a192699d6f7
2015-12-15 16:38:13 -08:00

53 lines
1.2 KiB
PHP

<?php
class EchoFlowThanksPresentationModel extends EchoEventPresentationModel {
public function canRender() {
return (bool)$this->event->getTitle();
}
public function getIconType() {
return 'thanks';
}
public function getHeaderMessage() {
$msg = parent::getHeaderMessage();
$msg->params( $this->event->getExtraParam( 'topic-title' ) );
$msg->params( $this->event->getTitle()->getPrefixedText() );
$msg->params( $this->getViewingUserForGender() );
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 array(
$title->getFullURL( array(
'workflow' => $this->event->getExtraParam( 'workflow' )
) ),
$this->msg( 'notification-link-text-view-post' )->text()
);
}
public function getSecondaryLinks() {
$agent = $this->event->getAgent();
if ( !$agent || !$this->userCan( Revision::DELETED_USER ) ) {
return array();
}
return array(
array(
'url' => $agent->getUserPage()->getLocalURL(),
'label' => $agent->getName(),
'icon' => 'userAvatar',
'prioritized' => true,
)
);
}
}