mediawiki-extensions-Discus.../includes/Notifications/EnhancedEchoMentionPresentationModel.php
Reedy 9ce8f3fc79 Add return type to jsonSerialize()
Bug: T311919
Change-Id: Ie77d7bc2902760972b8981a840bef91aae4ce5a3
(cherry picked from commit 54464f0b0c)
2022-07-10 20:01:45 +00:00

42 lines
877 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 {
$array = parent::jsonSerialize();
$array['links']['legacyPrimary'] = $this->addMarkAsRead( parent::getPrimaryLink() ) ?: [];
return $array;
}
}