mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-24 06:03:49 +00:00
Unbreak reverting 'degroup' action
This is something that hasn't been working since January 2009, when AF didn't have arrays and all variables were computed non-lazily. In fact, when reverting "degroup", we used to take old groups from edit vars, but the variable may not have been computed for such edit. Plus, we treated the var collection as an array instead of an AbuseFilterVariableHolder object, and exploded user_groups since it was a string. With this patch everything should start working as intended. Change-Id: I76917b2e331291bd42daeef8d048507dc38048cb
This commit is contained in:
parent
8adffed8af
commit
f93134a4f7
|
@ -1577,6 +1577,9 @@ class AbuseFilter {
|
|||
if ( !$wgUser->isAnon() ) {
|
||||
// Remove all groups from the user.
|
||||
$groups = $wgUser->getGroups();
|
||||
// Make sure that the stored var dump contains user groups, since we may
|
||||
// need them if reverting this degroup via Special:AbuseFilter/revert
|
||||
$vars->setVar( 'user_groups', $groups );
|
||||
|
||||
foreach ( $groups as $group ) {
|
||||
$wgUser->removeGroup( $group );
|
||||
|
|
|
@ -269,8 +269,7 @@ class AbuseFilterViewRevert extends AbuseFilterView {
|
|||
return true;
|
||||
case 'degroup':
|
||||
// Pull the user's groups from the vars.
|
||||
$oldGroups = $result['vars']['USER_GROUPS'];
|
||||
$oldGroups = explode( ',', $oldGroups );
|
||||
$oldGroups = $result['vars']->getVar( 'user_groups' )->toNative();
|
||||
$oldGroups = array_diff(
|
||||
$oldGroups,
|
||||
array_intersect( $oldGroups, User::getImplicitGroups() )
|
||||
|
|
Loading…
Reference in a new issue