Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 28 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
PageTriageAddMaintenanceTagPresentationModel | |
0.00% |
0 / 28 |
|
0.00% |
0 / 4 |
56 | |
0.00% |
0 / 1 |
getIconType | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getSecondaryLinks | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
6 | |||
getHeaderMessage | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
getThankLink | |
0.00% |
0 / 18 |
|
0.00% |
0 / 1 |
12 |
1 | <?php |
2 | |
3 | namespace MediaWiki\Extension\PageTriage\Notifications; |
4 | |
5 | use ExtensionRegistry; |
6 | use MediaWiki\SpecialPage\SpecialPage; |
7 | |
8 | class PageTriageAddMaintenanceTagPresentationModel extends PageTriagePresentationModel { |
9 | /** |
10 | * @inheritDoc |
11 | */ |
12 | public function getIconType() { |
13 | return 'reviewed'; |
14 | } |
15 | |
16 | /** |
17 | * @inheritDoc |
18 | */ |
19 | public function getSecondaryLinks() { |
20 | $links = [ $this->getAgentLink() ]; |
21 | $thankLink = $this->getThankLink(); |
22 | if ( $thankLink ) { |
23 | $links[] = $thankLink; |
24 | } |
25 | return $links; |
26 | } |
27 | |
28 | /** |
29 | * @inheritDoc |
30 | */ |
31 | public function getHeaderMessage() { |
32 | $msg = parent::getHeaderMessage(); |
33 | |
34 | // parent adds agent & gender, this adds title as 3rd param, tag list as |
35 | // 4th & amount of tags as 5th (for PLURAL) |
36 | $msg->params( $this->getTruncatedTitleText( $this->event->getTitle(), true ) ); |
37 | $msg->params( $this->getTagsForOutput() ); |
38 | |
39 | return $msg; |
40 | } |
41 | |
42 | /** |
43 | * @return array|false |
44 | */ |
45 | private function getThankLink() { |
46 | if ( !ExtensionRegistry::getInstance()->isLoaded( 'Thanks' ) ) { |
47 | return false; |
48 | } |
49 | |
50 | $revId = $this->event->getExtraParam( 'revId' ); |
51 | if ( !$revId ) { |
52 | return false; |
53 | } |
54 | |
55 | $thankingUser = $this->getViewingUserForGender(); |
56 | [ , $thankedUser ] = $this->getAgentForOutput(); |
57 | $labelMsg = $this->msg( 'pagetriage-thank-link' ); |
58 | $labelMsg->params( $thankingUser, $thankedUser ); |
59 | $descMsg = $this->msg( 'pagetriage-thank-link-title' ); |
60 | $descMsg->params( $thankingUser, $thankedUser ); |
61 | return [ |
62 | 'label' => $labelMsg->text(), |
63 | 'url' => SpecialPage::getTitleFor( 'Thanks', $revId )->getFullURL(), |
64 | 'icon' => 'thanks', |
65 | 'description' => $descMsg->text(), |
66 | 'prioritized' => true, |
67 | ]; |
68 | } |
69 | } |