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
*
date,
is_read,
link,
site,
summary,
title,
name
FROM
post
post p
JOIN feed f ON p.site = f.slug
WHERE
uid = $1

View File

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

View File

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