mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-28 18:21:50 +00:00
435b0c65c7
If the user talk edit or mention coincides with exactly one new comment: * Change the primary link to be a direct link to the comment * Add a text snippet to notifications that don't already include one (user talk edits that are not new sections). This is done for all such notifications, regardless of whether anyone has topic subscriptions enabled. Bug: T281590 Bug: T253082 Change-Id: I98fbca8e57845cd7c82ad533c393db953e4e5643
48 lines
1.1 KiB
PHP
48 lines
1.1 KiB
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 EchoEditUserTalkPresentationModel;
|
|
use Message;
|
|
use RawMessage;
|
|
|
|
class EnhancedEchoEditUserTalkPresentationModel extends EchoEditUserTalkPresentationModel {
|
|
|
|
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 getBodyMessage() {
|
|
if ( !$this->isBundled() ) {
|
|
// For events enhanced by DiscussionTools: add a text snippet
|
|
// (Echo can only do this for new sections, not for every comment)
|
|
$snippet = $this->getContentSnippet();
|
|
if ( $snippet ) {
|
|
return new RawMessage( '$1', [ Message::plaintextParam( $snippet ) ] );
|
|
}
|
|
}
|
|
return parent::getBodyMessage();
|
|
}
|
|
}
|