Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 19 |
|
0.00% |
0 / 6 |
CRAP | |
0.00% |
0 / 1 |
TopicResolvedPresentationModel | |
0.00% |
0 / 19 |
|
0.00% |
0 / 6 |
90 | |
0.00% |
0 / 1 |
getIconType | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
canRender | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
12 | |||
getPrimaryLink | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getSecondaryLinks | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
getHeaderMessageKey | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |||
getHeaderMessage | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace Flow\Notifications; |
4 | |
5 | class TopicResolvedPresentationModel extends FlowPresentationModel { |
6 | |
7 | /** @inheritDoc */ |
8 | public function getIconType() { |
9 | // flow-topic-resolved or flow-topic-reopened |
10 | return $this->event->getExtraParam( 'type' ); |
11 | } |
12 | |
13 | /** @inheritDoc */ |
14 | public function canRender() { |
15 | $type = $this->event->getExtraParam( 'type' ); |
16 | |
17 | return $this->hasTitle() |
18 | && $this->hasValidTopicWorkflowId() |
19 | && in_array( $type, [ 'flow-topic-resolved', 'flow-topic-reopened' ] ); |
20 | } |
21 | |
22 | /** @inheritDoc */ |
23 | public function getPrimaryLink() { |
24 | return $this->getViewTopicLink(); |
25 | } |
26 | |
27 | /** @inheritDoc */ |
28 | public function getSecondaryLinks() { |
29 | return [ |
30 | $this->getAgentLink(), |
31 | $this->getBoardLink(), |
32 | $this->getFlowUnwatchDynamicActionLink( true ), |
33 | ]; |
34 | } |
35 | |
36 | /** @inheritDoc */ |
37 | protected function getHeaderMessageKey() { |
38 | // notification-header-flow-topic-resolved, |
39 | // notification-header-flow-topic-reopened, |
40 | // notification-header-flow-topic-resolved-user-talk or |
41 | // notification-header-flow-topic-reopened-user-talk |
42 | $key = "notification-header-" . $this->event->getExtraParam( 'type' ); |
43 | if ( $this->isUserTalkPage() ) { |
44 | $key .= '-user-talk'; |
45 | } |
46 | |
47 | return $key; |
48 | } |
49 | |
50 | /** @inheritDoc */ |
51 | public function getHeaderMessage() { |
52 | $msg = $this->msg( $this->getHeaderMessageKey() ); |
53 | $msg->plaintextParams( $this->getTopicTitle() ); |
54 | $msg->params( $this->getViewingUserForGender() ); |
55 | return $msg; |
56 | } |
57 | } |