mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-12-18 02:51:26 +00:00
dd896deb45
The 'legacyPrimary' links will take you to the section the comment is in and should be used when you don't have access to comment IDs. Bug: T296018 Change-Id: I944feb90e7c3a69f81366f42fa110c58cac26dbb
42 lines
870 B
PHP
42 lines
870 B
PHP
<?php
|
|
/**
|
|
* Our override of the built-in Echo presentation model for user talk page notifications.
|
|
*
|
|
* @file
|
|
* @ingroup Extensions
|
|
* @license MIT
|
|
*/
|
|
|
|
namespace MediaWiki\Extension\DiscussionTools\Notifications;
|
|
|
|
use EchoMentionPresentationModel;
|
|
|
|
class EnhancedEchoMentionPresentationModel extends EchoMentionPresentationModel {
|
|
|
|
use DiscussionToolsEventTrait;
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function getPrimaryLink() {
|
|
$linkInfo = parent::getPrimaryLink();
|
|
// For events enhanced by DiscussionTools: link to the individual comment
|
|
$link = $this->getCommentLink();
|
|
if ( $link ) {
|
|
$linkInfo['url'] = $link;
|
|
}
|
|
return $linkInfo;
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function jsonSerialize() {
|
|
$array = parent::jsonSerialize();
|
|
|
|
$array['links']['legacyPrimary'] = $this->addMarkAsRead( parent::getPrimaryLink() ) ?: [];
|
|
|
|
return $array;
|
|
}
|
|
}
|