mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-12 09:26:05 +00:00
fc7e18ba8e
If a user is mentioned in an area that does not have a section title (for example, the lead section of a talk page), use the new 'notification-mention-nosection' message, to avoid an awkward and incorrect "[[Page#|]]". Bug: 52507 Change-Id: I40628b76c460c79008053222c9780bb23549731d
28 lines
878 B
PHP
28 lines
878 B
PHP
<?php
|
|
|
|
class EchoMentionFormatter extends EchoCommentFormatter {
|
|
/**
|
|
* {@inheritDoc}
|
|
*/
|
|
protected function applyChangeBeforeFormatting( EchoEvent $event, User $user, $type ) {
|
|
parent::applyChangeBeforeFormatting( $event, $user, $type );
|
|
|
|
// If we can't find a section title for the mention,
|
|
// fall back to `notification-mention-nosection`.
|
|
if ( !$this->getSectionTitle( $event, $user ) ) {
|
|
$this->title = array(
|
|
'message' => 'notification-mention-nosection',
|
|
'params' => array( 'agent', 'main-title-text', 'title' )
|
|
);
|
|
$this->flyoutTitle = array(
|
|
'message' => 'notification-mention-nosection-flyout',
|
|
'params' => array( 'agent', 'main-title-text', 'title' )
|
|
);
|
|
$this->email['batch-body'] = array(
|
|
'message' => 'notification-mention-nosection-email-batch-body',
|
|
'params' => array( 'agent', 'main-title-text' )
|
|
);
|
|
}
|
|
}
|
|
}
|