summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Brahmer <info@b-brahmer.de>2022-03-18 11:00:17 +0100
committerBenjamin Brahmer <info@b-brahmer.de>2022-03-18 11:54:02 +0100
commitc49e0fb4f43d6bda80eae9d075ff49e346e1dee4 (patch)
tree1d60eac0f532259010a10d559d402099d40577b9
parent409640818b3fb7d1ff4855d9665eb2eea4cfaee7 (diff)
rename maxItemId to newestItemId to match docs
Signed-off-by: Benjamin Brahmer <info@b-brahmer.de>
-rw-r--r--CHANGELOG.md1
-rw-r--r--lib/Controller/FolderApiController.php6
-rw-r--r--lib/Db/FolderMapperV2.php8
-rw-r--r--lib/Service/FolderServiceV2.php6
4 files changed, 11 insertions, 10 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b0c06da12..b823fffe5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,7 @@ The format is mostly based on [Keep a Changelog](https://keepachangelog.com/en/1
### Changed
### Fixed
+- Fix no item marked as read by Folder API due to mismatch in parameter name (#1703)
# Releases
## [18.0.1-beta1] - 2022-03-09
diff --git a/lib/Controller/FolderApiController.php b/lib/Controller/FolderApiController.php
index ce5d69f2b..c82347ca7 100644
--- a/lib/Controller/FolderApiController.php
+++ b/lib/Controller/FolderApiController.php
@@ -141,12 +141,12 @@ class FolderApiController extends ApiController
* @CORS
*
* @param int|null $folderId ID of the folder
- * @param int $maxItemId The newest read item
+ * @param int $newestItemId The newest read item
*/
- public function read(?int $folderId, int $maxItemId): void
+ public function read(?int $folderId, int $newestItemId): void
{
$folderId = $folderId === 0 ? null : $folderId;
- $this->folderService->read($this->getUserId(), $folderId, $maxItemId);
+ $this->folderService->read($this->getUserId(), $folderId, $newestItemId);
}
}
diff --git a/lib/Db/FolderMapperV2.php b/lib/Db/FolderMapperV2.php
index 7654d5a78..ea2edee91 100644
--- a/lib/Db/FolderMapperV2.php
+++ b/lib/Db/FolderMapperV2.php
@@ -101,14 +101,14 @@ class FolderMapperV2 extends NewsMapperV2
/**
* @param string $userId
* @param int $id
- * @param int|null $maxItemID
+ * @param int|null $maxItemId
*
* @return int
*
* @throws DBException
*
*/
- public function read(string $userId, int $id, ?int $maxItemID = null): int
+ public function read(string $userId, int $id, ?int $maxItemId = null): int
{
$idBuilder = $this->db->getQueryBuilder();
$idBuilder->select('items.id')
@@ -119,9 +119,9 @@ class FolderMapperV2 extends NewsMapperV2
->setParameter('userId', $userId)
->setParameter('folderId', $id);
- if ($maxItemID !== null) {
+ if ($maxItemId !== null) {
$idBuilder->andWhere('items.id <= :maxItemId')
- ->setParameter('maxItemId', $maxItemID);
+ ->setParameter('maxItemId', $maxItemId);
}
$idList = array_map(function ($value): int {
diff --git a/lib/Service/FolderServiceV2.php b/lib/Service/FolderServiceV2.php
index 17d955876..1e710a37b 100644
--- a/lib/Service/FolderServiceV2.php
+++ b/lib/Service/FolderServiceV2.php
@@ -184,17 +184,17 @@ class FolderServiceV2 extends Service
*
* @param string $userId Folder owner
* @param int $id Folder ID
- * @param int|null $maxItemID Highest item ID to mark as read
+ * @param int|null $newestItemId Highest item ID to mark as read
*
* @return int
*
* @throws ServiceConflictException
* @throws ServiceNotFoundException
*/
- public function read(string $userId, int $id, ?int $maxItemID = null): int
+ public function read(string $userId, int $id, ?int $newestItemId = null): int
{
$folder = $this->find($userId, $id);
- return $this->mapper->read($userId, $folder->getId(), $maxItemID);
+ return $this->mapper->read($userId, $folder->getId(), $newestItemId);
}
}