Skip to content

Commit

Permalink
fix TypeError caused by type conversion in controller
Browse files Browse the repository at this point in the history
Signed-off-by: anoy <anoymouserver+github@mailbox.org>
Signed-off-by: Marco Nassabain <marco.nassabain@hotmail.com>
  • Loading branch information
anoymouserver authored and mnassabain committed Mar 1, 2021
1 parent 6b0f863 commit e1dacc2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions lib/Controller/ItemApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ public function updated(int $type = 3, int $id = 0, int $lastModified = 0)
{
// 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()
);
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/ItemService.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function __construct(
*
* @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:
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Controller/ItemApiControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function testUpdated()
->with(
$this->equalTo(2),
$this->equalTo(1),
$this->equalTo('30000000'),
$this->equalTo(30000000),
$this->equalTo(true),
$this->equalTo($this->user->getUID())
)
Expand Down

0 comments on commit e1dacc2

Please sign in to comment.