blob: 1f48d9d339a1302aee8df32bec5a407a5d6b7de8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
<?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 = 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();
}
// Make a link to #flow-post-{postid}
$title = $title->createFragmentTarget( 'flow-post-' . $this->event->getExtraParam( 'post-id' ) );
return [
'url' => $title->getFullURL(),
'label' => $this->msg( 'notification-link-text-view-post' )->text(),
];
}
public function getSecondaryLinks() {
if ( $this->isBundled() ) {
return [ $this->getBoardLink() ];
} else {
return [ $this->getAgentLink(), $this->getBoardLink() ];
}
}
}
|