Add pretty site names to search and thread views

This commit is contained in:
Bill Thiede 2024-07-21 20:50:50 -07:00
parent ec41f840d5
commit 79db94f67f
3 changed files with 18 additions and 8 deletions

View File

@ -1,6 +1,13 @@
SELECT SELECT
* date,
is_read,
link,
site,
summary,
title,
name
FROM FROM
post post p
JOIN feed f ON p.site = f.slug
WHERE WHERE
uid = $1 uid = $1

View File

@ -1,7 +1,12 @@
SELECT SELECT
* date,
is_read,
title,
uid,
name
FROM FROM
post post p
JOIN feed f ON p.site = f.slug
WHERE WHERE
site = $1 site = $1
AND ( AND (

View File

@ -70,8 +70,7 @@ pub async fn search(
date_relative: "TODO date_relative".to_string(), date_relative: "TODO date_relative".to_string(),
matched: 0, matched: 0,
total: 1, total: 1,
// TODO: join with feed table and get pretty name authors: r.name.unwrap_or_else(|| site.clone()),
authors: site.clone(),
subject: r.title.unwrap_or("NO TITLE".to_string()), subject: r.title.unwrap_or("NO TITLE".to_string()),
tags, tags,
} }
@ -135,7 +134,7 @@ pub async fn thread(pool: &PgPool, thread_id: String) -> Result<Thread, ServerEr
}); });
let title = r.title.unwrap_or("NO TITLE".to_string()); let title = r.title.unwrap_or("NO TITLE".to_string());
let from = Some(Email { let from = Some(Email {
name: Some(site.clone()), name: r.name,
addr: r.link, addr: r.link,
}); });
Ok(Thread { Ok(Thread {
@ -143,7 +142,6 @@ pub async fn thread(pool: &PgPool, thread_id: String) -> Result<Thread, ServerEr
subject: title.clone(), subject: title.clone(),
messages: vec![Message { messages: vec![Message {
id, id,
// TODO: join with feed for pretty site name
from, from,
to: Vec::new(), to: Vec::new(),
cc: Vec::new(), cc: Vec::new(),