summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranoy <anoymouserver+github@mailbox.org>2021-01-15 21:47:18 +0100
committerSean Molenaar <SMillerDev@users.noreply.github.com>2021-01-17 17:56:37 +0100
commitc67feb8d8d388e3b16603b2253ad7f86d8d72fd9 (patch)
tree4c2e0a0a352f186d95b9d86171b24595da159cbe
parent4caa9d996df832fc43bd3fa71ba5d858a31cf2b5 (diff)
fix TypeError caused by type conversion in controller
Signed-off-by: anoy <anoymouserver+github@mailbox.org>
-rw-r--r--CHANGELOG.md1
-rw-r--r--lib/Controller/ItemApiController.php4
-rw-r--r--lib/Service/ItemService.php2
-rw-r--r--tests/Unit/Controller/ItemApiControllerTest.php2
4 files changed, 5 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 101e76299..238c535b0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,7 @@ The format is almost based on [Keep a Changelog](https://keepachangelog.com/en/1
### Fixed
- opened state of folders is not restored (#1040)
- Argument 3 passed to OCA\News\Db\ItemMapper::makeSelectQuery() must be of the type bool, array given (#1044)
+- Argument 2 passed to OCA\News\Db\ItemMapper::findAllNewFeed() must be of the type int, string given (#1049)
## [15.2.0-beta1] - 2021-01-11
diff --git a/lib/Controller/ItemApiController.php b/lib/Controller/ItemApiController.php
index c958324af..af36b87f0 100644
--- a/lib/Controller/ItemApiController.php
+++ b/lib/Controller/ItemApiController.php
@@ -93,14 +93,14 @@ class ItemApiController extends ApiController
{
// needs to be turned into a millisecond timestamp to work properly
if (strlen((string) $lastModified) <= 10) {
- $paddedLastModified = $lastModified . '000000';
+ $paddedLastModified = $lastModified * 1000000;
} else {
$paddedLastModified = $lastModified;
}
$items = $this->oldItemService->findAllNew(
$id,
$type,
- $paddedLastModified,
+ (int) $paddedLastModified,
true,
$this->getUserId()
);
diff --git a/lib/Service/ItemService.php b/lib/Service/ItemService.php
index 62a319346..8ba0a4b73 100644
--- a/lib/Service/ItemService.php
+++ b/lib/Service/ItemService.php
@@ -73,7 +73,7 @@ class ItemService extends Service
*
* @return array of items
*/
- public function findAllNew(?int $id, $type, $updatedSince, $showAll, $userId)
+ public function findAllNew(?int $id, $type, int $updatedSince, bool $showAll, string $userId)
{
switch ($type) {
case FeedType::FEED:
diff --git a/tests/Unit/Controller/ItemApiControllerTest.php b/tests/Unit/Controller/ItemApiControllerTest.php
index 8177bb0a2..91181333a 100644
--- a/tests/Unit/Controller/ItemApiControllerTest.php
+++ b/tests/Unit/Controller/ItemApiControllerTest.php
@@ -150,7 +150,7 @@ class ItemApiControllerTest extends TestCase
->with(
$this->equalTo(2),
$this->equalTo(1),
- $this->equalTo('30000000'),
+ $this->equalTo(30000000),
$this->equalTo(true),
$this->equalTo($this->user->getUID())
)