Skip to content

Commit

Permalink
fix: always add user to group cache
Browse files Browse the repository at this point in the history
When there is no user in a group, and we add one, it's not added to the group cache. So consecutive call of addUser() and getUsers() is inconsistent.
Furthermore, the user cache is never null, so this check is unesserary.

Signed-off-by: Hugo Renard <hugo.renard@protonmail.com>
  • Loading branch information
hrenard authored and Altahrim committed Mar 26, 2024
1 parent 47ac907 commit e389e63
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/private/Group/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,7 @@ public function addUser(IUser $user): void {
foreach ($this->backends as $backend) {
if ($backend->implementsActions(\OC\Group\Backend::ADD_TO_GROUP)) {
$backend->addToGroup($user->getUID(), $this->gid);
if ($this->users) {
$this->users[$user->getUID()] = $user;
}
$this->users[$user->getUID()] = $user;

$this->dispatcher->dispatchTyped(new UserAddedEvent($this, $user));

Expand Down

0 comments on commit e389e63

Please sign in to comment.