-
Notifications
You must be signed in to change notification settings - Fork 227
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
Update folder data even when the feed has no articles #1814
Update folder data even when the feed has no articles #1814
Conversation
Previously, if the feed had no articles at all, the `finalizeFolderRefresh:` method exited immediately, before applying any changes to the folder title, description, homepage or last-update string/date.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
call to Database's setLastUpdate:forFolder: should be displaced.
// Set the last update date for this folder. | ||
[dbManager setLastUpdate:[NSDate date] forFolder:folderId]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The last update date is displayed in the "Get Info…" window, and is useful for detecting that the feed is stale.
Therefore, we should update it only if new items are present…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The label in the info panel says "last refreshed" though, implying that Vienna did refresh the feed, whether the feed was updated or not. Also, as a result of this PR, the feed data is refreshed, even if it doesn't have any (new) entries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This conversation takes an interesting turn…
First, I have to make clear that, for a folder, the only role of the lastUpdate
field is to be displayed in the "Get Info…" window.
It must not be confused with lastUpdateString
, which is provided by the server and is used for optimizing network access.
That being said, the word "refreshed" can have slightly different meanings. In the context, I identify at least three possible nuances:
- fetched from server;
- got some article(s);
- got some new article(s) (fresh article(s)…)
From a user point of view, I think the most interesting meaning is the third one. Current implementation in OpenReader is aligned with this latest meaning. Cf.
vienna-rss/Vienna/Sources/Fetching/OpenReader.m
Lines 640 to 655 in 196afbb
// Here's where we add the articles to the database | |
if (articleArray.count > 0) { | |
[refreshedFolder resetArticleStatuses]; | |
NSArray *guidHistory = [dbManager guidHistoryForFolderId:refreshedFolder.itemId]; | |
for (Article *article in articleArray) { | |
if ([refreshedFolder createArticle:article guidHistory:guidHistory] && | |
(article.status == ArticleStatusNew)) | |
{ | |
newArticlesFromFeed++; | |
} | |
} | |
// Set the last update date for this folder. | |
[dbManager setLastUpdate:[NSDate date] forFolder:refreshedFolder.itemId]; | |
} |
I am not sure if this is what led me to modify the French translation of the "Last Refreshed" label during the development of version 3.8, in 2021 : 251861e#diff-987fbfdc228b4925f39ac4eaeae776a082dc0d34c459450200654da97f34ffd2 . I replaced "Dernier rafraîchissement" (which does not really sound French) with "Dernière actualisation" (which is closer to "Last Update").
My current opinion is that we should make Vienna consistent and adopt the OpenReader behavior mentioned beforehand:
- do not set
lastUpdate
anymore on 304 HTTP status :vienna-rss/Vienna/Sources/Fetching/RefreshManager.m
Lines 610 to 614 in 196afbb
if (responseStatusCode == 304) { // No modification from last check [dbManager setLastUpdate:[NSDate date] forFolder:folderId]; - update it only if
newArticlesFromFeed
> 0
The change would constitute a first step towards implementing a solution to issue #1638
Currently, OpenReader.m sets last_update only when some new articles are retrieved. Make RefreshManager behave the same and make label in InfoWindow clearer.
Feel free to remove my latest commit if you disagree. |
I can't review my own PR. 😀 You can approve and merge. |
strange Github behaviors 🤣 |
Closes #1813
Previously, if the feed had no articles at all, the
finalizeFolderRefresh:
method exited immediately, before applying any changes to the folder title, description, homepage or last-update string/date. Even if the feed has (currently) no articles, the feed-level data and last-refresh data ought to be updated.