Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
EnhancedEchoMentionPresentationModel
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 2
20
0.00% covered (danger)
0.00%
0 / 1
 getPrimaryLink
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
6
 jsonSerialize
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2/**
3 * Our override of the built-in Echo presentation model for user talk page notifications.
4 *
5 * @file
6 * @ingroup Extensions
7 * @license MIT
8 */
9
10namespace MediaWiki\Extension\DiscussionTools\Notifications;
11
12use EchoMentionPresentationModel;
13
14class EnhancedEchoMentionPresentationModel extends EchoMentionPresentationModel {
15
16    use DiscussionToolsEventTrait;
17
18    /**
19     * @inheritDoc
20     */
21    public function getPrimaryLink() {
22        $linkInfo = parent::getPrimaryLink();
23        // For events enhanced by DiscussionTools: link to the individual comment
24        $link = $this->getCommentLink();
25        if ( $link ) {
26            $linkInfo['url'] = $link;
27        }
28        return $linkInfo;
29    }
30
31    /**
32     * @inheritDoc
33     */
34    public function jsonSerialize(): array {
35        $array = parent::jsonSerialize();
36
37        $array['links']['legacyPrimary'] = $this->addMarkAsRead( parent::getPrimaryLink() ) ?: [];
38
39        return $array;
40    }
41}