Compare commits

..

No commits in common. "7b22f854294e5c0a1118b87831329bd9cf2cbc49" and "f1b5e789622dcce06a7f0357e8543bf5a7e0c971" have entirely different histories.

5 changed files with 14 additions and 73 deletions

View File

@ -67,7 +67,6 @@ pub struct Message {
// On disk location of message // On disk location of message
pub path: String, pub path: String,
pub attachments: Vec<Attachment>, pub attachments: Vec<Attachment>,
pub tags: Vec<String>,
} }
// Content-Type: image/jpeg; name="PXL_20231125_204826860.jpg" // Content-Type: image/jpeg; name="PXL_20231125_204826860.jpg"
@ -315,12 +314,6 @@ impl QueryRoot {
let mut messages = Vec::new(); let mut messages = Vec::new();
for (path, id) in std::iter::zip(nm.files(&thread_id)?, nm.message_ids(&thread_id)?) { for (path, id) in std::iter::zip(nm.files(&thread_id)?, nm.message_ids(&thread_id)?) {
info!("{id}\nfile: {path}"); info!("{id}\nfile: {path}");
let msg = nm.show(&format!("id:{id}"))?;
let tags = msg.0[0].0[0]
.0
.as_ref()
.map(|m| m.tags.clone())
.unwrap_or_else(Vec::default);
let file = File::open(&path)?; let file = File::open(&path)?;
let mmap = unsafe { MmapOptions::new().map(&file)? }; let mmap = unsafe { MmapOptions::new().map(&file)? };
let m = parse_mail(&mmap)?; let m = parse_mail(&mmap)?;
@ -379,7 +372,6 @@ impl QueryRoot {
to, to,
cc, cc,
subject, subject,
tags,
timestamp, timestamp,
headers, headers,
body, body,

View File

@ -504,30 +504,6 @@
} }
} }
} }
},
{
"args": [],
"deprecationReason": null,
"description": null,
"isDeprecated": false,
"name": "tags",
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
}
}
}
} }
], ],
"inputFields": null, "inputFields": null,

View File

@ -4,7 +4,6 @@ query ShowThreadQuery($threadId: String!) {
messages { messages {
id id
subject subject
tags
from { from {
name name
addr addr

View File

@ -12,14 +12,6 @@
.message { .message {
padding: 0.5em;*/ padding: 0.5em;*/
} }
.message .headers {
width: 100%;
}
.message .headers .header {
overflow: clip;
text-overflow: ellipsis;
white-space: nowrap;
}
.body { .body {
background: white; background: white;
color: black; color: black;

View File

@ -1,5 +1,5 @@
use std::{ use std::{
collections::{hash_map::DefaultHasher, HashSet}, collections::hash_map::DefaultHasher,
hash::{Hash, Hasher}, hash::{Hash, Hasher},
}; };
@ -265,33 +265,20 @@ fn raw_text_message(contents: &str) -> Node<Msg> {
fn thread(thread: &ShowThreadQueryThread) -> Node<Msg> { fn thread(thread: &ShowThreadQueryThread) -> Node<Msg> {
// TODO(wathiede): show per-message subject if it changes significantly from top-level subject // TODO(wathiede): show per-message subject if it changes significantly from top-level subject
set_title(&thread.subject); set_title(&thread.subject);
let mut tags: Vec<_> = thread
.messages
.iter()
.fold(HashSet::new(), |mut tags, msg| {
tags.extend(msg.tags.clone());
tags
})
.into_iter()
.collect();
tags.sort();
let messages = thread.messages.iter().map(|msg| { let messages = thread.messages.iter().map(|msg| {
div![ div![
C!["message"], C!["message"],
/* TODO(wathiede): collect all the tags and show them here. */
msg.from
.as_ref()
.map(|from| div![C!["header"], "From: ", view_address(&from)]),
msg.timestamp
.map(|ts| div![C!["header"], "Date: ", human_age(ts)]),
div!["Message-ID: ", &msg.id],
div![ div![
C!["headers"], C!["header"],
/* TODO(wathiede): collect all the tags and show them here. */ IF!(!msg.to.is_empty() => span!["To: ", view_addresses(&msg.to)]),
msg.from IF!(!msg.cc.is_empty() => span!["CC: ", view_addresses(&msg.cc)])
.as_ref()
.map(|from| div![C!["header"], "From: ", view_address(&from)]),
msg.timestamp
.map(|ts| div![C!["header"], "Date: ", human_age(ts)]),
div![C!["header"], "Message-ID: ", &msg.id],
div![
C!["header"],
IF!(!msg.to.is_empty() => span!["To: ", view_addresses(&msg.to)]),
IF!(!msg.cc.is_empty() => span!["CC: ", view_addresses(&msg.cc)])
],
], ],
div![ div![
C!["body"], C!["body"],
@ -333,12 +320,7 @@ fn thread(thread: &ShowThreadQueryThread) -> Node<Msg> {
}); });
div![ div![
C!["thread"], C!["thread"],
p![ p![C!["is-size-4"], &thread.subject],
C!["is-size-4"],
&thread.subject,
" ",
tags_chiclet(&tags, false)
],
messages, messages,
/* TODO(wathiede): plumb in orignal id /* TODO(wathiede): plumb in orignal id
a![ a![
@ -369,7 +351,7 @@ fn view_content_tree(content_tree: &str) -> Node<Msg> {
}) })
], ],
IF!(debug_open.get() => IF!(debug_open.get() =>
pre![C!["content-tree"], content_tree]), pre![C!["content-tree"], content_tree]),
] ]
} }