Move thread: and id: prefixing to server side.

This paves way for better news: support
This commit is contained in:
2024-07-22 14:26:48 -07:00
parent 879ddb112e
commit 4ee34444ae
4 changed files with 31 additions and 24 deletions

View File

@@ -80,7 +80,7 @@ pub async fn search(
.0
.into_iter()
.map(|ts| ThreadSummary {
thread: ts.thread,
thread: format!("thread:{}", ts.thread),
timestamp: ts.timestamp,
date_relative: ts.date_relative,
matched: ts.matched,
@@ -248,7 +248,7 @@ pub async fn thread(
// TODO(wathiede): parse message and fill out attachments
let attachments = extract_attachments(&m, &id)?;
messages.push(Message {
id,
id: format!("id:{id}"),
from,
to,
cc,
@@ -752,3 +752,16 @@ fn render_content_type_tree(m: &ParsedMail) -> String {
SKIP_HEADERS.join("\n ")
)
}
pub async fn set_read_status<'ctx>(
nm: &Notmuch,
query: String,
unread: bool,
) -> Result<bool, ServerError> {
if unread {
nm.tag_add("unread", &format!("{query}"))?;
} else {
nm.tag_remove("unread", &format!("{query}"))?;
}
Ok(true)
}