Add manual feed subscription #3
Loading…
Reference in a new issue
No description provided.
Delete branch "worktree-manual-feed-subscribe"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
dx components add button input) to the reader UIsubscribe_feedserver function upserts the feed row and does an immediate first fetch, so the reader isn't empty until the next scheduled pollfeedsignal_feeds::fetch_feednow also returns the feed's parsed title, used to replace the URL placeholder once fetchedTest plan
cargo check/cargo testacross native crates and bothfeedsignal-webfeature sets (server + wasm32)dx serve: subscribed to a real feed URL, saw "Subscribed — pulled in N article(s)." and the article list populateKnown follow-up (out of scope here)
"Not relevant" doesn't disable itself or remove the article from the list after dismissal — pre-existing gap, worth its own branch.
@ -40,0 +73,4 @@rsx! {form {class: "subscribe-form",onsubmit: move |ev| {Would indicate ev's type here for clarity as well
@ -9,3 +10,4 @@let bytes = reqwest::get(feed_url).await?.bytes().await?;let parsed = feed_rs::parser::parse(&bytes[..])?;let title = parsedRename to
feed_titlefor clarity of purpose@ -40,0 +52,4 @@let submit = move |_| {let feed_url = url.read().clone();if feed_url.trim().is_empty() {Good guard, would be also nice if the submit button wasn't clickable if the feed_url text box was empty
@ -12,0 +14,4 @@.title.as_ref().map(|t| t.content.clone()).filter(|t| !t.trim().is_empty())Any way to invert this logic so the check is positive instead of negative? Would help grok it faster. Not major either way.
@ -71,0 +72,4 @@/// already subscribed) and does an immediate first fetch so the reader/// isn't empty until the next scheduled poll. Returns the number of/// articles pulled in on this fetch.pub async fn subscribe_feed_impl(db: Db, url: String) -> Result<usize> {This feels pseudo duplicated compared to some of the earlier code. What is the reason for both subscription-centric methods existing, just for my own understanding?
@ -71,0 +74,4 @@/// articles pulled in on this fetch.pub async fn subscribe_feed_impl(db: Db, url: String) -> Result<usize> {let url = url.trim();anyhow::ensure!(!url.is_empty(), "feed URL is required");Wouldn't this make sense to have before the trim with a is_blank() style check? Aka check if it's not just pure whitespace?
@ -71,0 +76,4 @@let url = url.trim();anyhow::ensure!(!url.is_empty(), "feed URL is required");// Register under a placeholder title first so the feed exists even ifWhat if the url is correctly formed but otherwise points to nothing or a feed which no longer exists? Is this case handled?
Some aspects are unclear to me.
Also, more tests are needed.
We also need to do some thinking about the module architecture and how / whether an object oriented approach (not 100%, but more) might be sensible here.
@ -54,0 +77,4 @@/// A blank or whitespace-only feed title should be treated the same as/// a missing one, not surfaced as an empty string in the UI.#[test]fn has_content_rejects_blank_strings() {Make three separate unit tests instead of one so we know which case breaks if a regression occurs.
lgtm