Fix bug causing API to list anons as autoconfirmed in certain cases
On a stock install, the autoconfirmed requirements default to zero, so anons qualify for autoconfirmed. They don't actually get it because User::getEffectiveGroups() only checks for autopromote groups for logged-in users. However, ApiQueryUsers::getAutoGroups() (which duplicates this logic for some reason) didn't use the same rule and applied autopromote groups to anons too, which caused discrepancies betwen the API output and wgUserGroups. Krinkle noticed this because a QUnit test for mw.user.getGroups() was failing while logged out: the API response included autoconfirmed but wgUserGroups didn't. Change-Id: I0b781c11e06d3cc7176b2fb3ba06979d3637f970
This commit is contained in:
parent
b57a4db07b
commit
2a55449257
1 changed files with 3 additions and 1 deletions
|
|
@ -253,14 +253,16 @@ class ApiQueryUsers extends ApiQueryBase {
|
|||
* @return array
|
||||
*/
|
||||
public static function getAutoGroups( $user ) {
|
||||
// FIXME this logic is duplicated from User::getEffectiveGroups(), centralize this
|
||||
$groups = array();
|
||||
$groups[] = '*';
|
||||
|
||||
if ( !$user->isAnon() ) {
|
||||
$groups[] = 'user';
|
||||
$groups = array_merge( $groups, Autopromote::getAutopromoteGroups( $user ) );
|
||||
}
|
||||
|
||||
return array_merge( $groups, Autopromote::getAutopromoteGroups( $user ) );
|
||||
return $groups;
|
||||
}
|
||||
|
||||
public function getCacheMode( $params ) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue