mirror of
https://github.com/flarum/core.git
synced 2025-05-21 06:40:00 +02:00
Fix glitchy group editing
Currently, when groups are edited, the new groups flicker, but the UI soon reverts to the old groups. This is because the returned API response has the old group values. This, in turn, is because we eager load groups, and when we sync the new group relation, that doesn't update the groups saved in memory. By unsetting the relation, we make sure the right groups are returned (and also available to the GroupsChanged event). See https://github.com/flarum/core/issues/2514
This commit is contained in:
parent
9eb74fdc8a
commit
fede3f9fc7
@ -130,6 +130,7 @@ class EditUserHandler
|
||||
|
||||
$user->afterSave(function (User $user) use ($newGroupIds) {
|
||||
$user->groups()->sync($newGroupIds);
|
||||
$user->unsetRelation('groups');
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user