Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 25
0.00% covered (danger)
0.00%
0 / 5
CRAP
0.00% covered (danger)
0.00%
0 / 1
AddedTopicPresentationModel
0.00% covered (danger)
0.00%
0 / 25
0.00% covered (danger)
0.00%
0 / 5
72
0.00% covered (danger)
0.00%
0 / 1
 getPrimaryLink
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
6
 getHeaderMessageKey
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
6
 getHeaderMessage
0.00% covered (danger)
0.00%
0 / 10
0.00% covered (danger)
0.00%
0 / 1
6
 getCompactHeaderMessage
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
2
 getUnsubscribeConfirmationMessageKeys
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2/**
3 * EchoEventPresentationModel for added subscribable section headings
4 *
5 * @file
6 * @ingroup Extensions
7 * @license MIT
8 */
9
10namespace MediaWiki\Extension\DiscussionTools\Notifications;
11
12class AddedTopicPresentationModel extends SubscribedNewCommentPresentationModel {
13
14    /**
15     * @inheritDoc
16     */
17    public function getPrimaryLink() {
18        return [
19            'url' => $this->getCommentLink() ?: $this->section->getTitleWithSection()->getFullURL(),
20            'label' => $this->msg( 'discussiontools-notification-added-topic-view' )->text()
21        ];
22    }
23
24    /**
25     * @inheritDoc
26     */
27    protected function getHeaderMessageKey() {
28        if ( $this->isBundled() ) {
29            return 'discussiontools-notification-added-topic-header-bundled';
30        } else {
31            return 'discussiontools-notification-added-topic-header';
32        }
33    }
34
35    /**
36     * @inheritDoc
37     */
38    public function getHeaderMessage() {
39        if ( $this->isBundled() ) {
40            $count = $this->getNotificationCountForOutput();
41            $msg = $this->msg( $this->getHeaderMessageKey() );
42
43            $msg->numParams( $count );
44            $msg->params( $this->getTruncatedTitleText( $this->event->getTitle(), true ) );
45            return $msg;
46        } else {
47            $msg = parent::getHeaderMessage();
48            $msg->params( $this->getTruncatedTitleText( $this->event->getTitle(), true ) );
49            $msg->plaintextParams( $this->section->getTruncatedSectionTitle() );
50            return $msg;
51        }
52    }
53
54    /**
55     * @inheritDoc
56     */
57    public function getCompactHeaderMessage() {
58        $msg = $this->getMessageWithAgent( 'discussiontools-notification-added-topic-header-compact' );
59        $msg->plaintextParams( $this->section->getTruncatedSectionTitle() );
60        $msg->plaintextParams( $this->getContentSnippet() );
61        return $msg;
62    }
63
64    /**
65     * @inheritDoc
66     */
67    protected function getUnsubscribeConfirmationMessageKeys() {
68        return [
69            'title' => 'discussiontools-newtopicssubscription-notify-unsubscribed-title',
70            'description' => 'discussiontools-newtopicssubscription-notify-unsubscribed-body',
71        ];
72    }
73}