Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only one item marked as read when executing "mark items of a feed as read" using legacy API v1-2 #1544

Closed
3 tasks done
dennisschagt opened this issue Oct 21, 2021 · 5 comments
Labels

Comments

@dennisschagt
Copy link

dennisschagt commented Oct 21, 2021

  • I have read the CONTRIBUTING.md and followed the provided tips
  • I accept that the issue will be closed without comment if I do not check here
  • I accept that the issue will be closed without comment if I do not fill out all items in the issue template.

Explain the Problem

When using the mark items of a feed as read functionality of the v1-2 API, only one item is marked as read (always the same one).

I think I found the cause. The read function on the FeedApiController takes a feedId and newestItemId which it then passes as an itemId and a read boolean to a function on the ItemServiceV2 (which seems to only mark one item as read).

public function read(int $feedId, int $newestItemId): void
{
$this->itemService->read($this->getUserId(), $feedId, $newestItemId);
}

public function read(string $userId, int $id, bool $read): Entity
{
/** @var Item $item */
$item = $this->find($userId, $id);
$item->setUnread(!$read);
return $this->mapper->update($item);
}

I did not test with an older version of News, but it looks like this issue got introduced in b4fa772#diff-86a6e0a2c13497fea6daedeef4f01f06e9361023cd9c999fe60a49a962e77bc3R154

Steps to Reproduce

  1. Configured Newsboat to synchronize with News, using the Legacy External API v1-2
  2. In Newsboat, reload all feeds (retrieves all items from all feeds)
  3. In Newsboat, mark a feed as read
  4. In Newsboat, reload the feed

After following these steps, all items in the feed show up as unread again.

In case it is useful, a screenshot of a Wireshark trace of the transactions (relevant request: PUT /index.php/apps/news/api/v1-2/feeds/1/read?newestItemId=9223372036854775807 HTTP/1.1):
image

System Information

  • News app version: 16.1.0
  • Nextcloud version: 22.2.0
  • Cron type: not configured
  • PHP version: 8.0.11
  • Database and version: sqlite3
  • Browser and version: Not applicable
  • OS and version: Docker (uname -a -> "Linux 40f091d8901b 5.14.6-arch1-1")
Contents of nextcloud/data/nextcloud.log
Accidentally deleted it, probably not necessary
Contents of Browser Error Console
Not applicable
@m00fin
Copy link

m00fin commented Nov 14, 2021

I'm also experiencing this issue, here is my server log as the above mentioned he accidentally deleted his. :)

(Sorry not sure how to make the formatting better.)

`OCA\News\Service\Exceptions\ServiceNotFoundException: Did expect one result but found none when executing: query "SELECT 'items'.* FROM 'PREFIXnews_items' 'items' INNER JOIN 'PREFIXnews_feeds' 'feeds' ON items.feed_id = feeds.id WHERE (feeds.user_id = :user_id) AND (items.id = :item_id) AND (feeds.deleted_at = 0)";

/var/www/nextcloud/apps/news/lib/Service/Service.php - line 130:

OCA\News\Service\Exceptions\ServiceNotFoundException::from()

/var/www/nextcloud/apps/news/lib/Service/ItemServiceV2.php - line 140:

OCA\News\Service\Service->find()

/var/www/nextcloud/apps/news/lib/Controller/FeedApiController.php - line 155:

OCA\News\Service\ItemServiceV2->read()

/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 217:

OCA\News\Controller\FeedApiController->read()

/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 126:

OC\AppFramework\Http\Dispatcher->executeController()

/var/www/nextcloud/lib/private/AppFramework/App.php - line 156:

OC\AppFramework\Http\Dispatcher->dispatch()

/var/www/nextcloud/lib/private/Route/Router.php - line 302:

OC\AppFramework\App::main()

/var/www/nextcloud/lib/base.php - line 1006:

OC\Route\Router->match()

/var/www/nextcloud/index.php - line 36:

OC::handleRequest()

Caused by OCP\AppFramework\Db\DoesNotExistException: Did expect one result but found none when executing:
query "SELECT 'items'.* FROM 'PREFIXnews_items' 'items' INNER JOIN 'PREFIXnews_feeds' 'feeds' ON
items.feed_id = feeds.id WHERE (feeds.user_id = :user_id) AND (items.id = :item_id) AND (feeds.deleted_at = 0)";

/var/www/nextcloud/lib/public/AppFramework/Db/QBMapper.php - line 361:

OCP\AppFramework\Db\QBMapper->findOneQuery()

/var/www/nextcloud/apps/news/lib/Db/ItemMapperV2.php - line 102:

OCP\AppFramework\Db\QBMapper->findEntity()

/var/www/nextcloud/apps/news/lib/Service/Service.php - line 128:

OCA\News\Db\ItemMapperV2->findFromUser()

/var/www/nextcloud/apps/news/lib/Service/ItemServiceV2.php - line 140:

OCA\News\Service\Service->find()

/var/www/nextcloud/apps/news/lib/Controller/FeedApiController.php - line 155:

OCA\News\Service\ItemServiceV2->read()

/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 217:

OCA\News\Controller\FeedApiController->read()

/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 126:

OC\AppFramework\Http\Dispatcher->executeController()

/var/www/nextcloud/lib/private/AppFramework/App.php - line 156:

OC\AppFramework\Http\Dispatcher->dispatch()

/var/www/nextcloud/lib/private/Route/Router.php - line 302:

OC\AppFramework\App::main()

/var/www/nextcloud/lib/base.php - line 1006:

OC\Route\Router->match()

/var/www/nextcloud/index.php - line 36:

OC::handleRequest()`

@stale
Copy link

stale bot commented Jan 8, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale label Jan 8, 2022
@dennisschagt
Copy link
Author

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

I don't see any changes in the relevant code, so I expect this issue still exists.
I'm not planning to retest/comment every time the stale-bot shows up again.

@stale
Copy link

stale bot commented Apr 16, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale label Apr 16, 2022
@Grotax
Copy link
Member

Grotax commented Apr 16, 2022

Fixed

@stale stale bot removed the stale label Apr 16, 2022
@Grotax Grotax closed this as completed Apr 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants