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

Read status not synchronized when "Mark read" action is used in web app #975

Closed
chesio opened this issue Jun 9, 2021 · 16 comments
Closed
Labels

Comments

@chesio
Copy link

chesio commented Jun 9, 2021

Hello,

I've recently used the "Mark read" function in News Nextcloud web app to mark all unread items of several feeds as read. However, this change has not been synced to the Android app - in the Android app, all the items mark as read via the "Mark read" action of web app still show as unread.

However read status changed as a result of opening (= actually reading) of an item seems to be propagated correctly to the app...

I've tried clearing the cache and refreshing, it didn't help.

@chesio chesio changed the title Read status not synchronized Read status not synchronized when "Mark read" action is used in web app Jun 9, 2021
@David-Development
Copy link
Member

David-Development commented Jun 10, 2021

Thank you for the feedback. Not sure why the sync failed in this case. How many articles are we talking about (rough estimate)

So if I got this correctly

  • you marked all items as read (in the web app)
  • when you refresh the web app the articles are all gone as they are marked as read
  • the android app still shows them as "unread"
  • if you change the state of one of that "unread" items on your phone, the changes are propagated to the server correctly, right?

Can you try logging in and out of the android app again?

  • Open the nextcloud news android app
  • Click on
    • the profile icon (top right) - if you are using the new beta version
    • open the sidebar and click on settings (all the way on the bottom) - if you are using an older version of the app
  • Log in again (this will clear the apps cache and trigger a new synchronization)

@chesio
Copy link
Author

chesio commented Jun 10, 2021

Hi David,

thanks for quick reply. You got it correctly: sync worked ok both ways if only single item has been marked as read. When I marked all items in a feed as read via web app, it didn't sync to Android app. I processed 3 or 4 feeds this way, they had between 100 - 500 unread items each, the total number of unread items marked as read that didn't sync was roughly 800.

I followed you're suggestion and it did the trick. After new login, the Android app fetched only unread items. But the problem seems to persist - I marked another feed as read (86 items) in web app, but the same feed in Android app still has 86 unread items.

Is there any way how I can help pinpoint the problem? I have some experience debugging web apps, but sadly no experience with Android apps...

Btw. I noticed that after re-login all starred items are gone from Android app. I assume it's because they are all read and read items are not downloaded (unless "Download more" option is used). Or am I wrong?

@David-Development
Copy link
Member

Hm okay, thank you! Glad to hear that it did the trick. I'll have to look into it again.. Not sure why those "bulk" mark as read actions mess things up..

Btw. I noticed that after re-login all starred items are gone from Android app

we have some limits in place right now to not stress your phone too much by having a 1:1 copy of the database from the server. I'm not sure about the exact numbers but basically it should download let's say 1k articles to your phone. If you have already more than 1k unread articles, no starred articles will be synced. If you have let's say 500 unread articles in total, 500 of your starred items will be synced. I need to increase those numbers soon as modern phones are capable of handling those numbers easily. If you use the download more option you are forcing the app to ignore those limits and to download them anyways.

@dermitdemdino
Copy link

The same error occurs here too . The synchronization between web and app does not work when multiple articles are marked as read in the web app.

android
nextcloud

@utack
Copy link

utack commented Mar 4, 2022

Yep same for me
Can we post any logs that help?

@David-Development
Copy link
Member

I just ran a few tests on my nextcloud test instance. From what I can see this looks like a server side issue.

How to reproduce:

  • Create a test instance with unread articles
  • Hook up Android App
  • mark a single item as read (in the web app)
  • sync the android app
    • the app will download/update one article (which is correct)
  • Mark all articles of a folder as read (in the web app) -> all articles are immediately gone in the web app
  • Sync android app -> the endpoint /index.php/apps/news/api/v1-2/items/updated keeps on returning 1 article

It looks like the articles are not updated properly on the server (last modified date is not updated?).. 🤔 I tried to have a look at the server side code but I wasn't able to identify the issue. Maybe @Grotax has an idea? Is there a fundamental difference between a single mark as read operation and a bulk mark as read operation?

@Grotax
Copy link
Member

Grotax commented Mar 7, 2022

Yea very likely a bug in the server app accidentally introduced by the re-implementation of the API.

@chesio
Copy link
Author

chesio commented Mar 9, 2022

@Grotax is nextcloud/news#1687 related, ie. is it going to fix this problem?

@Grotax
Copy link
Member

Grotax commented Mar 9, 2022

No I don't think so, I just tried it on my own instance that is already updated.
Marked all items as read via the webapp via the three dot menu.
Sync with android app, all items still there.

No idea what the issue is.

@David-Development
Copy link
Member

@Grotax In case it helps... Just to make sure this is an backend problem and not some issue in the app I ran the following command in my terminal:

curl -u admin http://localhost/index.php/apps/news/api/v1-2/items/updated?lastModified=1636295405&type=3&id=0 | jq '. | length'

Just replace lastModified date with your current date (unix). If you mark a single item as read (after the time you specified) it should be returned by the api call. Right now the bulk changes are not included in the response.

@Grotax
Copy link
Member

Grotax commented Mar 9, 2022

Yea I have basically identified the issue, I think.
At least the services I checked so far, since the rewrite, do not update the lastModified timestamp.

The problem we have basically is that we do not have api testing in place.
Otherwise this would have been caught before.
That would require an actual instance of Nextcloud and news running inside of GitHub actions.

But it seems like we are actually already quite advanced in our testing compared to other projects. So there is nothing I could find to just copy paste.

So I have probably identified the issue but I don't have time and energy to fix it.

@David-Development
Copy link
Member

@Grotax Glad to hear that you managed to identify the issue. Is there anything we can help with? Do you want me to open a ticket in the news repo?

@Grotax
Copy link
Member

Grotax commented Mar 28, 2022

Well I started to write tests for the API and I can now actually reproduce the error :)

I will see if I can work on a fix soon and make the test work, apparently updating this timestamp was just forgotten long ago.

@David-Development
Copy link
Member

To keep everyone up to date - if I'm not mistaken the following MR fixes the issue. So it probably won't be long until this issue is fixed. Thank you so much @Grotax 🙇‍♂️

nextcloud/news#1713

@Grotax
Copy link
Member

Grotax commented May 29, 2022

The fix for the news (server) app is included in 18.1.0-beta1 for the first time.

Stable release will follow soon.

@chesio
Copy link
Author

chesio commented Jun 21, 2022

I've just upgraded my Nextcloud instance to News 18.1.0 and the problem is gone 😄

@Grotax and @David-Development - big thanks to you guys for your work on this!

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

6 participants