Treat email and news posts as distinct types on the frontend and backend

This commit is contained in:
2024-08-31 11:40:06 -07:00
parent 760cec01a8
commit a8d5617cf2
12 changed files with 324 additions and 72 deletions

View File

@@ -15,7 +15,7 @@ use crate::{
error::ServerError,
graphql::{
Attachment, Body, DispositionType, Email, EmailThread, Header, Html, Message, PlainText,
Tag, ThreadSummary, UnhandledContentType,
Tag, Thread, ThreadSummary, UnhandledContentType,
},
linkify_html, sanitize_html,
};
@@ -125,7 +125,7 @@ pub async fn thread(
nm: &Notmuch,
thread_id: String,
debug_content_tree: bool,
) -> Result<EmailThread, ServerError> {
) -> Result<Thread, ServerError> {
// TODO(wathiede): normalize all email addresses through an address book with preferred
// display names (that default to the most commonly seen name).
let mut messages = Vec::new();
@@ -246,11 +246,11 @@ pub async fn thread(
.next()
.and_then(|m| m.subject.clone())
.unwrap_or("(NO SUBJECT)".to_string());
Ok(EmailThread {
Ok(Thread::Email(EmailThread {
thread_id,
subject,
messages,
})
}))
}
fn email_addresses(