Browse Source

fix: always add user to group cache

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>
Hugo Renard 4 months ago
parent
commit
e389e63974
1 changed files with 1 additions and 3 deletions
  1. 1 3
      lib/private/Group/Group.php

+ 1 - 3
lib/private/Group/Group.php

@@ -184,9 +184,7 @@ class Group implements IGroup {
 		foreach ($this->backends as $backend) {
 		foreach ($this->backends as $backend) {
 			if ($backend->implementsActions(\OC\Group\Backend::ADD_TO_GROUP)) {
 			if ($backend->implementsActions(\OC\Group\Backend::ADD_TO_GROUP)) {
 				$backend->addToGroup($user->getUID(), $this->gid);
 				$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));
 				$this->dispatcher->dispatchTyped(new UserAddedEvent($this, $user));