Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/mail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Larch <anna@nextcloud.com>2022-08-25 12:28:27 +0300
committerAnna Larch <anna@nextcloud.com>2022-08-25 12:28:27 +0300
commit81c7e771f739ccac351e06fa19d5f4aee7b1afbe (patch)
tree5c678cea454c808ba7c970cbcb8ec283edf00424
parentca3f9296ba110725863f4a83e984a9bd77ac1776 (diff)
Remove unneccessary account checkperf/remove-account-check
As we're already joining on the user accounts table, the account doesn't need to be queried again for a single show. This is a mini performance optimistation. THe complete account data could also be returned with the JOIN queries as a second performance improvement, instead of querying the entity fromt he DB again The update method does just that at the moment. Signed-off-by: Anna Larch <anna@nextcloud.com>
-rw-r--r--lib/Controller/OutboxController.php1
-rw-r--r--tests/Unit/Controller/OutboxControllerTest.php21
2 files changed, 0 insertions, 22 deletions
diff --git a/lib/Controller/OutboxController.php b/lib/Controller/OutboxController.php
index e8716ad28..d4e868455 100644
--- a/lib/Controller/OutboxController.php
+++ b/lib/Controller/OutboxController.php
@@ -75,7 +75,6 @@ class OutboxController extends Controller {
*/
public function show(int $id): JsonResponse {
$message = $this->service->getMessage($id, $this->userId);
- $this->accountService->find($this->userId, $message->getAccountId());
return JsonResponse::success($message);
}
diff --git a/tests/Unit/Controller/OutboxControllerTest.php b/tests/Unit/Controller/OutboxControllerTest.php
index 688c3bc21..313511936 100644
--- a/tests/Unit/Controller/OutboxControllerTest.php
+++ b/tests/Unit/Controller/OutboxControllerTest.php
@@ -98,8 +98,6 @@ class OutboxControllerTest extends TestCase {
->method('getMessage')
->with($message->getId(), $this->userId)
->willReturn($message);
- $this->accountService->expects(self::once())
- ->method('find');
$expected = JsonResponse::success($message);
$actual = $this->controller->show($message->getId());
@@ -115,30 +113,11 @@ class OutboxControllerTest extends TestCase {
->method('getMessage')
->with($message->getId(), $this->userId)
->willThrowException(new DoesNotExistException(''));
- $this->accountService->expects(self::never())
- ->method('find');
$this->expectException(DoesNotExistException::class);
$this->controller->show($message->getId());
}
- public function testShowAccountNotFound(): void {
- $message = new LocalMessage();
- $message->setId(1);
- $message->setAccountId(1);
-
- $this->service->expects(self::once())
- ->method('getMessage')
- ->with($message->getId(), $this->userId)
- ->willReturn($message);
- $this->accountService->expects(self::once())
- ->method('find')
- ->willThrowException(new ClientException('', 400));
-
- $this->expectException(ClientException::class);
- $this->controller->show($message->getId());
- }
-
public function testSend(): void {
$message = new LocalMessage();
$message->setId(1);