| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
namespace MediaWiki\Extension\DiscussionTools\Notifications; |
| 11 |
|
| 12 |
use MediaWiki\Extension\Notifications\Formatters\EchoEditUserTalkPresentationModel; |
| 13 |
use MediaWiki\Language\RawMessage; |
| 14 |
use MediaWiki\Message\Message; |
| 15 |
use Wikimedia\Timestamp\TimestampException; |
| 16 |
|
| 17 |
class EnhancedEchoEditUserTalkPresentationModel extends EchoEditUserTalkPresentationModel { |
| 18 |
|
| 19 |
use DiscussionToolsEventTrait; |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
public function getPrimaryLink() { |
| 25 |
$linkInfo = parent::getPrimaryLink(); |
| 26 |
|
| 27 |
$link = $this->getCommentLink(); |
| 28 |
if ( $link ) { |
| 29 |
$linkInfo['url'] = $link; |
| 30 |
} |
| 31 |
return $linkInfo; |
| 32 |
} |
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
public function getBodyMessage() { |
| 38 |
if ( !$this->isBundled() ) { |
| 39 |
|
| 40 |
|
| 41 |
$snippet = $this->getContentSnippet(); |
| 42 |
if ( $snippet ) { |
| 43 |
return new RawMessage( '$1', [ Message::plaintextParam( $snippet ) ] ); |
| 44 |
} |
| 45 |
} |
| 46 |
return parent::getBodyMessage(); |
| 47 |
} |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
public function jsonSerialize(): array { |
| 54 |
$array = parent::jsonSerialize(); |
| 55 |
|
| 56 |
$array['links']['legacyPrimary'] = $this->addMarkAsRead( parent::getPrimaryLink() ) ?: []; |
| 57 |
|
| 58 |
return $array; |
| 59 |
} |
| 60 |
} |