mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-12-24 13:55:04 +00:00
d1bffdee70
Change-Id: I80377881e6aabf3014394c024fca6af50166aa1a
44 lines
997 B
PHP
44 lines
997 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 MediaWiki\Extension\Notifications\Formatters\EchoMentionPresentationModel;
|
|
use Wikimedia\Timestamp\TimestampException;
|
|
|
|
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
|
|
* @throws TimestampException
|
|
*/
|
|
public function jsonSerialize(): array {
|
|
$array = parent::jsonSerialize();
|
|
|
|
$array['links']['legacyPrimary'] = $this->addMarkAsRead( parent::getPrimaryLink() ) ?: [];
|
|
|
|
return $array;
|
|
}
|
|
}
|