rename maxItemId to newestItemId to match docs

Signed-off-by: Benjamin Brahmer <info@b-brahmer.de>
This commit is contained in:
Benjamin Brahmer 2022-03-18 11:00:17 +01:00
parent 409640818b
commit c49e0fb4f4
4 changed files with 11 additions and 10 deletions

View File

@ -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

View File

@ -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);
}
}

View File

@ -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 {

View File

@ -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);
}
}