Add feed sidebar navigation #8

Merged
schaefera merged 14 commits from worktree-feed-sidebar-nav into main 2026-09-15 07:20:41 +00:00
3 changed files with 5 additions and 17 deletions
Showing only changes of commit 33d2dfe011 - Show all commits

View file

@ -26,21 +26,9 @@ impl Db {
Ok(Uuid::parse_str(&id)?) Ok(Uuid::parse_str(&id)?)
} }
/// All subscribed feeds, for the polling job to iterate over. /// All subscribed feeds, ordered by title. Used both by the polling job
pub async fn list_feeds(&self) -> Result<Vec<(Uuid, String)>> { /// (iterating to fetch each feed) and the sidebar's feed-navigation list.
use schema::feeds::dsl; pub async fn list_feeds(&self) -> Result<Vec<(Uuid, String, String)>> {
let mut conn = self.pool.get().await?;
let rows: Vec<(String, String)> = dsl::feeds
.select((dsl::id, dsl::url))
.load(&mut conn)
.await?;
rows.into_iter()
.map(|(id, url)| Ok((Uuid::parse_str(&id)?, url)))
.collect()
}
/// All subscribed feeds with their titles, for the sidebar's feed list.
pub async fn list_feeds_with_titles(&self) -> Result<Vec<(Uuid, String, String)>> {
use schema::feeds::dsl; use schema::feeds::dsl;
let mut conn = self.pool.get().await?; let mut conn = self.pool.get().await?;
let rows: Vec<(String, String, String)> = dsl::feeds let rows: Vec<(String, String, String)> = dsl::feeds

View file

@ -10,7 +10,7 @@ pub async fn run(db: &Db) -> Result<()> {
let feeds = db.list_feeds().await?; let feeds = db.list_feeds().await?;
tracing::info!(count = feeds.len(), "polling subscribed feeds"); tracing::info!(count = feeds.len(), "polling subscribed feeds");
for (feed_id, url) in feeds { for (feed_id, _title, url) in feeds {
let (_title, articles) = match feedsignal_feeds::fetch_feed(&url, feed_id).await { let (_title, articles) = match feedsignal_feeds::fetch_feed(&url, feed_id).await {
Ok(result) => result, Ok(result) => result,
Err(err) => { Err(err) => {

View file

@ -36,7 +36,7 @@ pub async fn subscribe(db: Db, url: String) -> Result<usize> {
/// Lists every subscribed feed, for the sidebar's feed-navigation list. /// Lists every subscribed feed, for the sidebar's feed-navigation list.
pub async fn list(db: Db) -> Result<Vec<FeedView>> { pub async fn list(db: Db) -> Result<Vec<FeedView>> {
Ok(db Ok(db
.list_feeds_with_titles() .list_feeds()
.await? .await?
.into_iter() .into_iter()
.map(|(id, title, url)| FeedView { .map(|(id, title, url)| FeedView {