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

Update folder data even when the feed has no articles #1814

Merged
merged 2 commits into from
Sep 15, 2024

Conversation

Eitot
Copy link
Contributor

@Eitot Eitot commented Sep 15, 2024

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.

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.
Copy link
Member

@barijaona barijaona left a 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.

Comment on lines 769 to 770
// Set the last update date for this folder.
[dbManager setLastUpdate:[NSDate date] forFolder:folderId];
Copy link
Member

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…

Copy link
Contributor Author

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.

Copy link
Member

@barijaona barijaona Sep 15, 2024

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.

// 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 :
    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

Vienna/Sources/Fetching/RefreshManager.m Show resolved Hide resolved
Currently, OpenReader.m sets last_update only when some new articles are
retrieved.
Make RefreshManager behave the same and make label in InfoWindow clearer.
@barijaona
Copy link
Member

Feel free to remove my latest commit if you disagree.

@barijaona barijaona added the changes localisations 💬 This pull request adds, changes or removes localisation keys. label Sep 15, 2024
@Eitot
Copy link
Contributor Author

Eitot commented Sep 15, 2024

I can't review my own PR. 😀 You can approve and merge.

@barijaona barijaona merged commit 032e45a into ViennaRSS:master Sep 15, 2024
2 checks passed
@barijaona
Copy link
Member

I can't review my own PR. 😀 You can approve and merge.

strange Github behaviors 🤣

@Eitot Eitot deleted the feature/refresh-folder-data branch September 16, 2024 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changes localisations 💬 This pull request adds, changes or removes localisation keys.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Empty Atom feed results in "(Untitled Feed)" in sidebar, but the feed has a title
2 participants