1
0
mirror of https://github.com/chylex/Nextcloud-News.git synced 2025-04-09 19:15:42 +02:00

remove duplicate function

Signed-off-by: Paul Tirk <paultirk@paultirk.com>
This commit is contained in:
Paul Tirk 2022-04-11 15:53:44 +00:00 committed by Benjamin Brahmer
parent b9c4f0bacb
commit 115df4b9e2
3 changed files with 3 additions and 29 deletions

View File

@ -231,7 +231,7 @@ class ItemApiController extends ApiController
private function setStarredByItemId(int $itemId, bool $isStarred)
{
try {
$this->itemService->starByItemId($this->getUserId(), $itemId, $isStarred);
$this->itemService->star($this->getUserId(), $itemId, $isStarred);
} catch (ServiceNotFoundException $ex) {
return $this->error($ex, Http::STATUS_NOT_FOUND);
}

View File

@ -211,32 +211,6 @@ class ItemServiceV2 extends Service
return $this->mapper->update($item);
}
/**
* Mark an item as starred by id
*
* @param string $userId Item owner
* @param int $itemId
* @param bool $starred
*
* @return Item
* @throws ServiceConflictException
* @throws ServiceNotFoundException
*/
public function starByItemId(string $userId, int $itemId, bool $starred): Entity
{
try {
$item = $this->mapper->findFromUser($userId, $itemId);
} catch (DoesNotExistException $ex) {
throw ServiceNotFoundException::from($ex);
} catch (MultipleObjectsReturnedException $ex) {
throw ServiceConflictException::from($ex);
}
$item->setStarred($starred);
return $this->mapper->update($item);
}
/**
* Mark all items as read
*

View File

@ -502,7 +502,7 @@ class ItemApiControllerTest extends TestCase
public function testStarByItemId()
{
$this->itemService->expects($this->once())
->method('starByItemId')
->method('star')
->with($this->uid, 123, true);
$this->class->starByItemId(123);
@ -512,7 +512,7 @@ class ItemApiControllerTest extends TestCase
public function testUnstarByItemId()
{
$this->itemService->expects($this->once())
->method('starByItemId')
->method('star')
->with($this->uid, 123, false);
$this->class->unstarByItemId(123);