mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-30 16:54:18 +00:00
a8c9fab2cc
The following sniffs are failing and were disabled: * MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic Change-Id: I6075c76d53a899aac56af027f9a956a6b9e6a667
66 lines
1.8 KiB
PHP
66 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace MediaWiki\Extension\AbuseFilter;
|
|
|
|
use EchoEventPresentationModel;
|
|
use Message;
|
|
|
|
class ThrottleFilterPresentationModel extends EchoEventPresentationModel {
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function getIconType() {
|
|
return 'placeholder';
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function getHeaderMessage() {
|
|
$text = $this->event->getTitle()->getText();
|
|
[ , $filter ] = explode( '/', $text, 2 );
|
|
$disabledActions = $this->event->getExtraParam( 'throttled-actions' );
|
|
if ( $disabledActions === null ) {
|
|
// BC for when we didn't include the actions here.
|
|
return $this->msg( 'notification-header-throttle-filter' )
|
|
->params( $this->getViewingUserForGender() )
|
|
->numParams( $filter );
|
|
}
|
|
if ( $disabledActions ) {
|
|
$specsFormatter = AbuseFilterServices::getSpecsFormatter();
|
|
$specsFormatter->setMessageLocalizer( $this );
|
|
$disabledActionsLocalized = [];
|
|
foreach ( $disabledActions as $action ) {
|
|
$disabledActionsLocalized[] = $specsFormatter->getActionMessage( $action )->text();
|
|
}
|
|
return $this->msg( 'notification-header-throttle-filter-actions' )
|
|
->params( $this->getViewingUserForGender() )
|
|
->numParams( $filter )
|
|
->params( Message::listParam( $disabledActionsLocalized ) )
|
|
->params( count( $disabledActionsLocalized ) );
|
|
}
|
|
return $this->msg( 'notification-header-throttle-filter-no-actions' )
|
|
->params( $this->getViewingUserForGender() )
|
|
->numParams( $filter );
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function getSubjectMessage() {
|
|
return $this->msg( 'notification-subject-throttle-filter' )
|
|
->params( $this->getViewingUserForGender() );
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function getPrimaryLink() {
|
|
return [
|
|
'url' => $this->event->getTitle()->getFullURL(),
|
|
'label' => $this->msg( 'notification-link-text-show-filter' )->text()
|
|
];
|
|
}
|
|
}
|