Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 17
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
MentionStatusPresentationModel
0.00% covered (danger)
0.00%
0 / 17
0.00% covered (danger)
0.00%
0 / 2
12
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
2
 getTopicOrPostUrl
0.00% covered (danger)
0.00%
0 / 13
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2
3namespace Flow\Notifications;
4
5use MediaWiki\Extension\Notifications\Formatters\EchoMentionStatusPresentationModel;
6use MediaWiki\Title\Title;
7
8class MentionStatusPresentationModel extends EchoMentionStatusPresentationModel {
9
10    /** @inheritDoc */
11    public function getPrimaryLink() {
12        return array_merge(
13            parent::getPrimaryLink(),
14            [ 'url' => $this->getTopicOrPostUrl() ]
15        );
16    }
17
18    /**
19     * @return string
20     */
21    private function getTopicOrPostUrl() {
22        $workflowId = $this->event->getExtraParam( 'topic-workflow' );
23        $postId = $this->event->getExtraParam( 'post-id' );
24        $fragment = '';
25        $query = [ 'fromnotif' => 1 ];
26        if ( $postId ) {
27            $fragment = 'flow-post-' . $postId->getAlphadecimal();
28            $query[ 'topic_showPostId' ] = $postId->getAlphadecimal();
29        }
30        $topicTitle = Title::makeTitleSafe(
31            NS_TOPIC,
32            $workflowId->getAlphadecimal(),
33            $fragment
34        );
35        return $topicTitle->getFullURL( $query );
36    }
37}