Skip to content

Do not update feeds after import - #5629

Merged
Alkarex merged 10 commits into
FreshRSS:edgefrom
robertdahlem:no-update-after-import
Oct 22, 2023
Merged

Alkarex merged 10 commits into
FreshRSS:edgefrom
robertdahlem:no-update-after-import

Conversation

@robertdahlem

Copy link
Copy Markdown
Contributor

Importing multiple files tends to create duplicate feeds when the feeds are updated between imports. This is because updating feeds might change _feed.url especially with PubSubHubBub feeds but also in other scenarios. (Because of the other scenarios it is not enough to set pubsubhubbub_enabled to false while importing). When the next import runs, the importer tries to match the URL with existing feeds, fails and creates a new feed.

Of course automatic feed updates by cron or alternatives should be deactivated during imports. The message near the new checkbox says so.

@Alkarex Alkarex added this to the 1.23.0 milestone Sep 4, 2023
@Alkarex

Alkarex commented Sep 4, 2023

Copy link
Copy Markdown
Member

A bit related to this draft #5584

@Alkarex

Alkarex commented Sep 4, 2023

Copy link
Copy Markdown
Member

I have not understood what changes it makes to not automatically update the feeds after import? Could you please try to explain some more?

@robertdahlem

Copy link
Copy Markdown
Contributor Author

I have not understood what changes it makes to not automatically update the feeds after import? Could you please try to explain some more?

Sorry for answering so late.

Take a look at http://xkcd.com/rss.xml. It 301s to https://xkcd.com/rss.xml, the HTTPS variant. TT-RSS ignores this because fox is fox. FreshRSS instead takes note and updates _feed.url while updating the feeds.

Now import this:

  "items": [
    {
      "categories": [
        "user/-/state/com.google/read"
      ],
      "guid": "SHA1:eebc13be8c417ff82a43b505d9f2a299aa678943",
      "origin": {
        "title": "xkcd.com",
        "feedUrl": "http://xkcd.com/rss.xml",
        "htmlUrl": "http://xkcd.com/"
      },
      "url": "https://xkcd.com/2677/",
      "title": "Some title",
      "content": "some stuff",
      "published": "2022-09-26 04:00:00"
    }
  ]
}

FreshRSS imports it, updates the feeds, sees the 301 and updates _feed.url.

Now import another file with the same feedUrl and a different guid. FreshRSS doesn't find a match for the http variant and creates a new feed. It looks like a duplicate but when you delete one of the duplicates, you lose articles.

This can only be avoided by NOT updating the feeds between multiple imports.

@Alkarex

Alkarex commented Sep 10, 2023

Copy link
Copy Markdown
Member

Instead of a new option, I would better like that we never auto-refresh feeds after an import, and modify the i18n strings

from:

'feeds_imported' => 'Your feeds have been imported and will now be updated',
'feeds_imported_with_errors' => 'Your feeds have been imported, but some errors occurred',

to something like:

'feeds_imported' => 'Your feeds have been imported. If you are done importing, you may now click the <i>Update feeds</i> button.',
'feeds_imported_with_errors' => 'Your feeds have been imported, but some errors occurred. If you are done importing, you may now click the <i>Update feeds</i> button.',

Ping @Frenzie for a potentially better wording

@Frenzie

Frenzie commented Sep 10, 2023

Copy link
Copy Markdown
Member

Would you want to mention something about reenabling cron?

@Alkarex

Alkarex commented Sep 10, 2023

Copy link
Copy Markdown
Member

@Frenzie I am afraid cron-aspects go beyond what many users can do. In particular, it requires server-admin access. So I am afraid it might be more confusing than helpful, so I think we should leave that to the migration guide.

Note for later: the whole problem of feeds changing addresses should be addressed with a better logic during the import, because disabling the refresh of feeds only addresses a tiny part of the use cases.

@Alkarex Alkarex modified the milestones: 1.23.0, 1.22.0 Sep 10, 2023
@Alkarex Alkarex added the UX User experience label Sep 10, 2023
@Frenzie

Frenzie commented Sep 10, 2023

Copy link
Copy Markdown
Member

Right, I forgot for a second that mentioning cron was proposed in this PR rather than the current situation. :-)

I'd make it "If you're done importing, you can now click the Update feeds button." but that's merely a minor stylistic preference for being less formal.

@robertdahlem

Copy link
Copy Markdown
Contributor Author

Instead of a new option, I would better like that we never auto-refresh feeds after an import, and modify the i18n strings

I'm happy with never auto-refreshing. Do you expect me to change my PR or will you do that yourself? Apart of dropping the most of my i18n changes it's just the deletion of the update line.

@Frenzie

Frenzie commented Sep 11, 2023

Copy link
Copy Markdown
Member

Simply removing the actualize_feeds line sounds fine by me anyway.

@Alkarex

Alkarex commented Sep 11, 2023

Copy link
Copy Markdown
Member

An update of your PR would be welcome, @robertdahlem

@robertdahlem

robertdahlem commented Sep 23, 2023 •

Copy link
Copy Markdown
Contributor Author

An update of your PR would be welcome, @robertdahlem

I updated my changes to skip feed updates unconditionally and merged the changes to the i18n strings. Hope I did everything right with GitHub, this is my first PR.

Comment thread app/i18n/fr/feedback.php Resolved
@Alkarex

Alkarex commented Sep 23, 2023

Copy link
Copy Markdown
Member

Well done 👍🏻
If have only done some minor fixes 127edaf

@Alkarex Alkarex changed the title Add checkbox to not update feeds after import Do not update feeds after import Sep 23, 2023
@Alkarex
Alkarex merged commit 83cf730 into FreshRSS:edge Oct 22, 2023
@Alkarex

Alkarex commented Oct 24, 2023

Copy link
Copy Markdown
Member

Help welcome #5731 (comment)

@robertdahlem

Copy link
Copy Markdown
Contributor Author

Help welcome #5731 (comment)

I see the problem:

In importAction() in app/Controllers/importExportController.php the call Minz_Session::_param('actualize_feeds', true);has been deleted to avoid feed updates after JSON imports. Unfortunately importAction() is called for all kinds of imports, including OPML where you probably want to do a feed update afterwards.

The decision what kind of import we are doing is in importFile() which returns true for "ok" and false for "error". Instead it should perhaps return 0 for "error", 1 for "ok, don't update feeds" (it was a JSON import) and 2 for "ok, update feeds" (it was an OPML import).

The big "but" is: you can import ZIP files, that include JSON and OPML. In this case the answer would be 3, meaning "you can't have nice things :-)".

All in all I think it said "Your feeds have been imported. If you are done importing, you can now click the Update feeds button." after the import. Which is what you suggested in #5731. What exactly is wrong with the wording?

I read about needing to click Update feeds twice. This has nothing to do with this PR but what is done after clicking the button.

@Alkarex

Alkarex commented Oct 24, 2023

Copy link
Copy Markdown
Member

The problematic wording is This feed is empty. Please verify that it is still maintained.

@robertdahlem

Copy link
Copy Markdown
Contributor Author

The problematic wording is This feed is empty. Please verify that it is still maintained.

I see.

Maybe in importFile() we should do something like $force_refresh = true in the OPML part when $importService->lastStatus() is true and call Minz_Session::_param('actualize_feeds', true); before return $ok; when $force_refresh is true.

This probably would avoid the problematic wording.

The corner case is still a ZIP file with OPML and JSON in it. But anyway: who has a ZIP file with OPML and JSON in it where the JSON files are only a part of the import? I would call that "asking for trouble".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

UX User experience

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants