fix: update attachments count when sharing

Signed-off-by: Luka Trovic <luka@nextcloud.com>
This commit is contained in:
Luka Trovic
2022-04-27 09:40:27 +02:00
committed by backportbot-nextcloud[bot]
parent 461ed6b81f
commit bfcd5357e3
3 changed files with 26 additions and 7 deletions

View File

@@ -137,16 +137,17 @@ class AttachmentService {
/**
* @param $cardId
* @param bool $update | Force the update of the cached values
* @return int|mixed
* @throws BadRequestException
*/
public function count($cardId) {
public function count($cardId, $update = false) {
if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number');
}
$count = $this->cache->get('card-' . $cardId);
if (!$count) {
if ($update OR !$count) {
$count = count($this->attachmentMapper->findAll($cardId));
foreach (array_keys($this->services) as $attachmentType) {