* This change introduces two new optional parameters to the 'allusers' API call named 'excludenamed' and 'excludetemp' that allows filtering accounts based on whether they're named accounts or temporary accounts. This is tested by using the temporary matchPattern configured with $wgAutoCreateTempUser. * User widgets that call 'allusers' have been updated so that 'excludenamed' and 'excludetemp' can be optionally set so that named or temporary accounts may not returned with user suggestions. Bug: T332030 Change-Id: I6563ae610017fd1cd35c36ba65906041f7f68c4b
55 lines
1.1 KiB
PHP
55 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace MediaWiki\Widget;
|
|
|
|
use OOUI\TextInputWidget;
|
|
|
|
/**
|
|
* User input widget.
|
|
*
|
|
* @copyright 2011-2015 MediaWiki Widgets Team and others; see AUTHORS.txt
|
|
* @license MIT
|
|
*/
|
|
class UserInputWidget extends TextInputWidget {
|
|
/** @var bool */
|
|
protected $excludeNamed;
|
|
|
|
/** @var bool */
|
|
protected $excludeTemp;
|
|
|
|
/**
|
|
* @param array $config Configuration options
|
|
*/
|
|
public function __construct( array $config = [] ) {
|
|
parent::__construct( $config );
|
|
|
|
if ( isset( $config['excludenamed'] ) ) {
|
|
$this->excludeNamed = $config['excludenamed'];
|
|
}
|
|
|
|
if ( isset( $config['excludetemp'] ) ) {
|
|
$this->excludeTemp = $config['excludetemp'];
|
|
}
|
|
|
|
// Initialization
|
|
$this->addClasses( [ 'mw-widget-userInputWidget' ] );
|
|
}
|
|
|
|
protected function getJavaScriptClassName() {
|
|
return 'mw.widgets.UserInputWidget';
|
|
}
|
|
|
|
public function getConfig( &$config ) {
|
|
$config['$overlay'] = true;
|
|
|
|
if ( $this->excludeNamed !== null ) {
|
|
$config['excludenamed'] = $this->excludeNamed;
|
|
}
|
|
|
|
if ( $this->excludeTemp !== null ) {
|
|
$config['excludetemp'] = $this->excludeTemp;
|
|
}
|
|
|
|
return parent::getConfig( $config );
|
|
}
|
|
}
|