From e0953027508a824566f80cff70254658cc8c6fa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Tue, 29 Dec 2020 16:36:16 +0100 Subject: [PATCH] Fix counting attachments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/Service/AttachmentService.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/Service/AttachmentService.php b/lib/Service/AttachmentService.php index c0471cc92..36ce4b7bc 100644 --- a/lib/Service/AttachmentService.php +++ b/lib/Service/AttachmentService.php @@ -152,11 +152,17 @@ class AttachmentService { $count = $this->cache->get('card-' . $cardId); if (!$count) { $count = count($this->attachmentMapper->findAll($cardId)); + + foreach (array_keys($this->services) as $attachmentType) { + $service = $this->getService($attachmentType); + if ($service instanceof ICustomAttachmentService) { + $count += $service->getAttachmentCount($cardId); + } + } + $this->cache->set('card-' . $cardId, $count); } - - return $count; }