mediawiki-extensions-Thanks/ThanksPresentationModel.php
Roan Kattouw 190ace1ed7 Convert Echo notifications to the new system
* Add ThanksPresentationModel and FlowThanksPresentationModel
* Rename notification-thanks-flyout2 to notification-header-edit-thank,
  shift parameters around and add GENDER support for thanked user
* Rename notification-flow-thanks-flyout to notification-header-flow-thank
  and shift parameters around; this one did already have GENDER support
  for the thanked user

Depends on Idb975feaec in Echo.

Bug: T116847
Change-Id: Iab0f2311e7ffb6a9ce21cd76e564511d03805530
2015-10-28 17:29:55 -07:00

45 lines
1.1 KiB
PHP

<?php
class EchoThanksPresentationModel 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->getTitle()->getPrefixedText() );
$user = User::newFromId( $this->event->getExtraParam( 'thanked-user-id' ) );
$msg->params( $user ? $user->getName() : '[]' );
return $msg;
}
public function getPrimaryLink() {
return array(
$this->event->getTitle()->getLocalURL( array(
'oldid' => 'prev',
'diff' => $this->event->getExtraParam( 'revid' )
) ),
$this->msg( 'notification-link-text-view-edit' )
);
}
// TODO add thanking user as secondary link once we can make that look nice (T115421)
/*
public function getSecondaryLinks() {
$agent = $this->event->getAgent();
if ( !$agent || !$this->userCan( Revision::DELETED_USER ) ) {
return array();
}
$url = $agent->getUserPage()->getLocalURL();
return array(
$url => $agent->getName()
);
}
*/
}