2021-04-30 16:07:31 +00:00
|
|
|
<?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;
|
|
|
|
|
2024-05-28 14:46:27 +00:00
|
|
|
use MediaWiki\Extension\Notifications\Formatters\EchoMentionPresentationModel;
|
2022-10-28 18:24:02 +00:00
|
|
|
use Wikimedia\Timestamp\TimestampException;
|
2021-04-30 16:07:31 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
2021-12-09 00:13:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritDoc
|
2022-10-28 18:24:02 +00:00
|
|
|
* @throws TimestampException
|
2021-12-09 00:13:21 +00:00
|
|
|
*/
|
2022-07-02 15:36:39 +00:00
|
|
|
public function jsonSerialize(): array {
|
2021-12-09 00:13:21 +00:00
|
|
|
$array = parent::jsonSerialize();
|
|
|
|
|
|
|
|
$array['links']['legacyPrimary'] = $this->addMarkAsRead( parent::getPrimaryLink() ) ?: [];
|
|
|
|
|
|
|
|
return $array;
|
|
|
|
}
|
2021-04-30 16:07:31 +00:00
|
|
|
}
|