Make user rights conflict error a bit more obvious
[lhc/web/wiklou.git] / includes / specials / SpecialUserrights.php
index 4168d91..3c2907b 100644 (file)
@@ -170,10 +170,12 @@ class UserrightsPage extends SpecialPage {
                                $targetUser->clearInstanceCache(); // T40989
                        }
 
-                       if ( $request->getVal( 'conflictcheck-originalgroups' )
-                               !== implode( ',', $targetUser->getGroups() )
-                       ) {
-                               $out->addWikiMsg( 'userrights-conflict' );
+                       $conflictCheck = $request->getVal( 'conflictcheck-originalgroups' );
+                       $conflictCheck = ( $conflictCheck === '' ) ? [] : explode( ',', $conflictCheck );
+                       $userGroups = $targetUser->getGroups();
+
+                       if ( $userGroups !== $conflictCheck ) {
+                               $out->wrapWikiMsg( '<span class="error">$1</span>', 'userrights-conflict' );
                        } else {
                                $status = $this->saveUserGroups(
                                        $this->mTarget,