Also restore support for old 'hidebots' and 'hidesysops' options.
Bug: T116354
Change-Id: I68887509c3dbf74598a1af82623b9f0f5a1ab43d
$opts->add( 'username', '' );
$opts->add( 'groups', [] );
+ $opts->add( 'excludegroups', [] );
+ // Backwards-compatibility with old URLs
+ $opts->add( 'hidebots', false, FormOptions::BOOL );
+ $opts->add( 'hidesysops', false, FormOptions::BOOL );
$opts->fetchValuesFromRequest( $this->getRequest() );
$options[$msg] = $group;
}
+ // Backwards-compatibility with old URLs
+ $req = $this->getRequest();
+ $excludeDefault = [];
+ if ( $req->getCheck( 'hidebots' ) ) {
+ $excludeDefault[] = 'bot';
+ }
+ if ( $req->getCheck( 'hidesysops' ) ) {
+ $excludeDefault[] = 'sysop';
+ }
+
$formDescriptor = [
'username' => [
'type' => 'user',
'name' => 'username',
'label-message' => 'activeusers-from',
],
-
'groups' => [
'type' => 'multiselect',
'dropdown' => true,
'label-message' => 'activeusers-groups',
'options' => $options,
],
+ 'excludegroups' => [
+ 'type' => 'multiselect',
+ 'dropdown' => true,
+ 'flatlist' => true,
+ 'name' => 'excludegroups',
+ 'label-message' => 'activeusers-excludegroups',
+ 'options' => $options,
+ 'default' => $excludeDefault,
+ ],
];
HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() )
}
$this->groups = $opts->getValue( 'groups' );
+ $this->excludegroups = $opts->getValue( 'excludegroups' );
+ // Backwards-compatibility with old URLs
+ if ( $opts->getValue( 'hidebots' ) ) {
+ $this->excludegroups[] = 'bot';
+ }
+ if ( $opts->getValue( 'hidesysops' ) ) {
+ $this->excludegroups[] = 'sysop';
+ }
}
function getIndexField() {
$conds[] = 'ug_user = user_id';
$conds['ug_group'] = $this->groups;
}
+ if ( $this->excludegroups !== [] ) {
+ foreach ( $this->excludegroups as $group ) {
+ $conds[] = 'NOT EXISTS (' . $dbr->selectSQLText(
+ 'user_groups', '1', [ 'ug_user = user_id', 'ug_group' => $group ]
+ ) . ')';
+ }
+ }
if ( !$this->getUser()->isAllowed( 'hideuser' ) ) {
$conds[] = 'NOT EXISTS (' . $dbr->selectSQLText(
'ipblocks', '1', [ 'ipb_user=user_id', 'ipb_deleted' => 1 ]
"activeusers-count": "$1 {{PLURAL:$1|action|actions}} in the last {{PLURAL:$3|day|$3 days}}",
"activeusers-from": "Display users starting at:",
"activeusers-groups": "Display users belonging to groups:",
+ "activeusers-excludegroups": "Exclude users belonging to groups:",
"activeusers-noresult": "No users found.",
"activeusers-submit": "Display active users",
"listgrouprights": "User group rights",
"activeusers-count": "Used in [[Special:ActiveUsers]] to show the active user's recent action count in brackets ([]).\n* $1 is the number of recent actions\n* $2 is the user's name for use with GENDER (optional)\n* $3 is the maximum number of days of the RecentChangesList",
"activeusers-from": "Used as label for checkbox in the form on [[Special:ActiveUsers]].\n\nidentical with {{msg-mw|listusersfrom}}\n\nSee also:\n* {{msg-mw|activeusers|legend for the form}}",
"activeusers-groups": "Used as label on [[Special:ActiveUsers]].",
+ "activeusers-excludegroups": "Used as an option on [[Special:ActiveUsers]].",
"activeusers-noresult": "identical with {{msg-mw|listusers-noresult}}",
"activeusers-submit": "Used as label for button in the form on [[Special:ActiveUsers]]",
"listgrouprights": "The name of the special page [[Special:ListGroupRights]].",