Skip to content

Commit 8ebeeaa

Browse files
author
Carl Schwan
committed
perf: Use getBoard to get the board
So that this can benefit from a local cache Signed-off-by: Carl Schwan <carl.schwan@nextclound.com>
1 parent ce81c89 commit 8ebeeaa

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

lib/Service/PermissionService.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ public function findUsers($boardId, $refresh = false) {
214214
}
215215

216216
try {
217-
$board = $this->boardMapper->find($boardId);
217+
$board = $this->getBoard($boardId);
218218
} catch (DoesNotExistException $e) {
219219
return [];
220220
} catch (MultipleObjectsReturnedException $e) {
@@ -227,7 +227,7 @@ public function findUsers($boardId, $refresh = false) {
227227
} else {
228228
$users[$board->getOwner()] = new User($board->getOwner(), $this->userManager);
229229
}
230-
$acls = $this->aclMapper->findAll($boardId);
230+
$acls = $board->getAcl();
231231
/** @var Acl $acl */
232232
foreach ($acls as $acl) {
233233
if ($acl->getType() === Acl::PERMISSION_TYPE_USER) {

tests/unit/Service/PermissionServiceTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,8 @@ public function testFindUsers() {
347347
->method('__call')
348348
->with('getOwner', [])
349349
->willReturn('user1');
350-
$this->aclMapper->expects($this->once())
351-
->method('findAll')
352-
->with(123)
350+
$board->expects($this->any())
351+
->method('getAcl')
353352
->willReturn([$aclUser, $aclGroup]);
354353
$this->boardMapper->expects($this->once())
355354
->method('find')

0 commit comments

Comments
 (0)