2014-02-26 02:12:47 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class EchoFlowThanksFormatter extends EchoBasicFormatter {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param $event EchoEvent
|
|
|
|
* @param $param
|
|
|
|
* @param $message Message
|
|
|
|
* @param $user User
|
|
|
|
*/
|
|
|
|
protected function processParam( $event, $param, $message, $user ) {
|
|
|
|
if ( $param === 'postlink' ) {
|
|
|
|
$this->setTitleLink(
|
|
|
|
$event,
|
|
|
|
$message,
|
2016-04-22 20:13:56 +00:00
|
|
|
[
|
2014-02-26 02:12:47 +00:00
|
|
|
'class' => 'mw-echo-diff',
|
|
|
|
'linkText' => $this->getMessage( 'notification-flow-thanks-post-link' )->text(),
|
2016-04-22 20:13:56 +00:00
|
|
|
'param' => [
|
2014-02-26 02:12:47 +00:00
|
|
|
'workflow' => $event->getExtraParam( 'workflow' ),
|
2016-04-22 20:13:56 +00:00
|
|
|
],
|
2014-02-26 02:12:47 +00:00
|
|
|
'fragment' => "flow-post-{$event->getExtraParam( 'post-id' )}",
|
2016-04-22 20:13:56 +00:00
|
|
|
]
|
2014-02-26 02:12:47 +00:00
|
|
|
);
|
|
|
|
} elseif ( $param === 'topictitle' ) {
|
|
|
|
$message->params( $event->getExtraParam( 'topic-title' ) );
|
|
|
|
} else {
|
|
|
|
parent::processParam( $event, $param, $message, $user );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Overriding implementation in EchoBasicFormatter to support Flow posts
|
|
|
|
*
|
|
|
|
* @param EchoEvent $event
|
|
|
|
* @param User $user The user receiving the notification
|
|
|
|
* @param String $destination The destination type for the link, e.g. 'agent'
|
|
|
|
* @return Array including target and query parameters
|
|
|
|
*/
|
|
|
|
protected function getLinkParams( $event, $user, $destination ) {
|
|
|
|
$target = null;
|
2016-04-22 20:13:56 +00:00
|
|
|
$query = [];
|
2014-02-26 02:12:47 +00:00
|
|
|
|
|
|
|
if ( $destination === 'post' ) {
|
|
|
|
$target = $event->getTitle();
|
|
|
|
if ( $target ) {
|
|
|
|
$target->setFragment( '#flow-post-' . $event->getExtraParam( 'post-id' ) );
|
|
|
|
$query['workflow'] = $event->getExtraParam( 'workflow' );
|
|
|
|
}
|
2016-04-22 20:13:56 +00:00
|
|
|
return [ $target, $query ];
|
2014-02-26 02:12:47 +00:00
|
|
|
} else {
|
|
|
|
return parent::getLinkParams( $event, $user, $destination );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|