Compare commits
No commits in common. "7ee86f0d2f2c027c4d06c4aae6ce161c9e7a0b38" and "122e9490722dbd8c2c1347c40e439637eec81d31" have entirely different histories.
7ee86f0d2f
...
122e949072
19
Cargo.lock
generated
19
Cargo.lock
generated
@ -863,9 +863,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "clap"
|
||||||
version = "4.5.37"
|
version = "4.5.36"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "eccb054f56cbd38340b380d4a8e69ef1f02f1af43db2f0cc817a4774d80ae071"
|
checksum = "2df961d8c8a0d08aa9945718ccf584145eee3f3aa06cddbeac12933781102e04"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap_builder",
|
"clap_builder",
|
||||||
"clap_derive",
|
"clap_derive",
|
||||||
@ -873,9 +873,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_builder"
|
name = "clap_builder"
|
||||||
version = "4.5.37"
|
version = "4.5.36"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "efd9466fac8543255d3b1fcad4762c5e116ffe808c8a3043d4263cd4fd4862a2"
|
checksum = "132dbda40fb6753878316a489d5a1242a8ef2f0d9e47ba01c951ea8aa7d013a5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstream",
|
"anstream",
|
||||||
"anstyle",
|
"anstyle",
|
||||||
@ -2995,7 +2995,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "letterbox-notmuch"
|
name = "letterbox-notmuch"
|
||||||
version = "0.15.9"
|
version = "0.15.7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itertools",
|
"itertools",
|
||||||
"log",
|
"log",
|
||||||
@ -3010,15 +3010,14 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "letterbox-procmail2notmuch"
|
name = "letterbox-procmail2notmuch"
|
||||||
version = "0.15.9"
|
version = "0.15.7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "letterbox-server"
|
name = "letterbox-server"
|
||||||
version = "0.15.9"
|
version = "0.15.7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ammonia",
|
"ammonia",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
@ -3062,7 +3061,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "letterbox-shared"
|
name = "letterbox-shared"
|
||||||
version = "0.15.9"
|
version = "0.15.7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"build-info",
|
"build-info",
|
||||||
"letterbox-notmuch",
|
"letterbox-notmuch",
|
||||||
@ -3072,7 +3071,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "letterbox-web"
|
name = "letterbox-web"
|
||||||
version = "0.15.9"
|
version = "0.15.7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"build-info",
|
"build-info",
|
||||||
"build-info-build",
|
"build-info-build",
|
||||||
|
|||||||
@ -8,7 +8,7 @@ authors = ["Bill Thiede <git@xinu.tv>"]
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "UNLICENSED"
|
license = "UNLICENSED"
|
||||||
publish = ["xinu"]
|
publish = ["xinu"]
|
||||||
version = "0.15.9"
|
version = "0.15.7"
|
||||||
repository = "https://git.z.xinu.tv/wathiede/letterbox"
|
repository = "https://git.z.xinu.tv/wathiede/letterbox"
|
||||||
|
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
|
|||||||
@ -12,4 +12,3 @@ version.workspace = true
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = "1.0.69"
|
anyhow = "1.0.69"
|
||||||
clap = { version = "4.5.37", features = ["derive"] }
|
|
||||||
|
|||||||
@ -1,15 +1,13 @@
|
|||||||
use std::{collections::HashMap, convert::Infallible, io::Write, str::FromStr};
|
use std::{convert::Infallible, io::Write, str::FromStr};
|
||||||
|
|
||||||
use clap::{Parser, ValueEnum};
|
#[derive(Debug, Default)]
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash, Ord, PartialOrd)]
|
|
||||||
enum MatchType {
|
enum MatchType {
|
||||||
From,
|
From,
|
||||||
Sender,
|
Sender,
|
||||||
To,
|
To,
|
||||||
Cc,
|
Cc,
|
||||||
Subject,
|
Subject,
|
||||||
ListId,
|
List,
|
||||||
DeliveredTo,
|
DeliveredTo,
|
||||||
XForwardedTo,
|
XForwardedTo,
|
||||||
ReplyTo,
|
ReplyTo,
|
||||||
@ -28,7 +26,7 @@ struct Match {
|
|||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default)]
|
||||||
struct Rule {
|
struct Rule {
|
||||||
matches: Vec<Match>,
|
matches: Vec<Match>,
|
||||||
tags: Option<String>,
|
tags: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn unescape(s: &str) -> String {
|
fn unescape(s: &str) -> String {
|
||||||
@ -40,10 +38,6 @@ fn cleanup_match(prefix: &str, s: &str) -> String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mod matches {
|
mod matches {
|
||||||
// From https://linux.die.net/man/5/procmailrc
|
|
||||||
// If the regular expression contains '^TO_' it will be substituted by '(^((Original-)?(Resent-)?(To|Cc|Bcc)|(X-Envelope |Apparently(-Resent)?)-To):(.*[^-a-zA-Z0-9_.])?)'
|
|
||||||
// If the regular expression contains '^TO' it will be substituted by '(^((Original-)?(Resent-)?(To|Cc|Bcc)|(X-Envelope |Apparently(-Resent)?)-To):(.*[^a-zA-Z])?)', which should catch all destination specifications containing a specific word.
|
|
||||||
|
|
||||||
pub const TO: &'static str = "TO";
|
pub const TO: &'static str = "TO";
|
||||||
pub const CC: &'static str = "Cc";
|
pub const CC: &'static str = "Cc";
|
||||||
pub const TOCC: &'static str = "(TO|Cc)";
|
pub const TOCC: &'static str = "(TO|Cc)";
|
||||||
@ -115,7 +109,7 @@ impl FromStr for Match {
|
|||||||
});
|
});
|
||||||
} else if needle.starts_with(LIST_ID) {
|
} else if needle.starts_with(LIST_ID) {
|
||||||
return Ok(Match {
|
return Ok(Match {
|
||||||
match_type: MatchType::ListId,
|
match_type: MatchType::List,
|
||||||
needle: cleanup_match(LIST_ID, needle),
|
needle: cleanup_match(LIST_ID, needle),
|
||||||
});
|
});
|
||||||
} else if needle.starts_with(REPLY_TO) {
|
} else if needle.starts_with(REPLY_TO) {
|
||||||
@ -161,7 +155,7 @@ fn notmuch_from_rules<W: Write>(mut w: W, rules: &[Rule]) -> anyhow::Result<()>
|
|||||||
let mut lines = Vec::new();
|
let mut lines = Vec::new();
|
||||||
for r in rules {
|
for r in rules {
|
||||||
for m in &r.matches {
|
for m in &r.matches {
|
||||||
if let Some(t) = &r.tags {
|
for t in &r.tags {
|
||||||
if let MatchType::Unknown = m.match_type {
|
if let MatchType::Unknown = m.match_type {
|
||||||
eprintln!("rule has unknown match {:?}", r);
|
eprintln!("rule has unknown match {:?}", r);
|
||||||
continue;
|
continue;
|
||||||
@ -174,7 +168,7 @@ fn notmuch_from_rules<W: Write>(mut w: W, rules: &[Rule]) -> anyhow::Result<()>
|
|||||||
MatchType::To => "to:",
|
MatchType::To => "to:",
|
||||||
MatchType::Cc => "to:",
|
MatchType::Cc => "to:",
|
||||||
MatchType::Subject => "subject:",
|
MatchType::Subject => "subject:",
|
||||||
MatchType::ListId => "List-ID:",
|
MatchType::List => "List-ID:",
|
||||||
MatchType::Body => "",
|
MatchType::Body => "",
|
||||||
// TODO(wathiede): these will probably require adding fields to notmuch
|
// TODO(wathiede): these will probably require adding fields to notmuch
|
||||||
// index. Handle them later.
|
// index. Handle them later.
|
||||||
@ -206,28 +200,11 @@ fn notmuch_from_rules<W: Write>(mut w: W, rules: &[Rule]) -> anyhow::Result<()>
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)]
|
|
||||||
enum Mode {
|
|
||||||
Debug,
|
|
||||||
Notmuchrc,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Simple program to greet a person
|
|
||||||
#[derive(Parser, Debug)]
|
|
||||||
#[command(version, about, long_about = None)]
|
|
||||||
struct Args {
|
|
||||||
#[arg(short, long, default_value = "/home/wathiede/dotfiles/procmailrc")]
|
|
||||||
input: String,
|
|
||||||
|
|
||||||
#[arg(value_enum)]
|
|
||||||
mode: Mode,
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() -> anyhow::Result<()> {
|
fn main() -> anyhow::Result<()> {
|
||||||
let args = Args::parse();
|
let input = "/home/wathiede/dotfiles/procmailrc";
|
||||||
let mut rules = Vec::new();
|
let mut rules = Vec::new();
|
||||||
let mut cur_rule = Rule::default();
|
let mut cur_rule = Rule::default();
|
||||||
for l in std::fs::read_to_string(args.input)?.lines() {
|
for l in std::fs::read_to_string(input)?.lines() {
|
||||||
let l = if let Some(idx) = l.find('#') {
|
let l = if let Some(idx) = l.find('#') {
|
||||||
&l[..idx]
|
&l[..idx]
|
||||||
} else {
|
} else {
|
||||||
@ -253,7 +230,7 @@ fn main() -> anyhow::Result<()> {
|
|||||||
}
|
}
|
||||||
'.' => {
|
'.' => {
|
||||||
// delivery to folder
|
// delivery to folder
|
||||||
cur_rule.tags = Some(cleanup_match(
|
cur_rule.tags.push(cleanup_match(
|
||||||
"",
|
"",
|
||||||
&l.replace('.', "/")
|
&l.replace('.', "/")
|
||||||
.replace(' ', "")
|
.replace(' ', "")
|
||||||
@ -263,35 +240,16 @@ fn main() -> anyhow::Result<()> {
|
|||||||
rules.push(cur_rule);
|
rules.push(cur_rule);
|
||||||
cur_rule = Rule::default();
|
cur_rule = Rule::default();
|
||||||
}
|
}
|
||||||
'/' => cur_rule = Rule::default(), // Ex. /dev/null
|
|
||||||
'|' => cur_rule = Rule::default(), // external command
|
'|' => cur_rule = Rule::default(), // external command
|
||||||
'$' => {
|
'$' => {
|
||||||
// TODO(wathiede): tag messages with no other tag as 'inbox'
|
// TODO(wathiede): tag messages with no other tag as 'inbox'
|
||||||
cur_rule.tags = Some(cleanup_match("", "inbox"));
|
cur_rule.tags.push(cleanup_match("", "inbox"));
|
||||||
rules.push(cur_rule);
|
rules.push(cur_rule);
|
||||||
cur_rule = Rule::default();
|
cur_rule = Rule::default();
|
||||||
} // variable, should only be $DEFAULT in my config
|
} // variable, should only be $DEFAULT in my config
|
||||||
_ => panic!("Unhandled first character '{}'\nLine: {}", first, l),
|
_ => panic!("Unhandled first character '{}' {}", first, l),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
match args.mode {
|
notmuch_from_rules(std::io::stdout(), &rules)?;
|
||||||
Mode::Debug => print_rules(&rules),
|
|
||||||
Mode::Notmuchrc => notmuch_from_rules(std::io::stdout(), &rules)?,
|
|
||||||
}
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_rules(rules: &[Rule]) {
|
|
||||||
let mut tally = HashMap::new();
|
|
||||||
for r in rules {
|
|
||||||
for m in &r.matches {
|
|
||||||
*tally.entry(m.match_type).or_insert(0) += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let mut sorted: Vec<_> = tally.iter().map(|(k, v)| (v, k)).collect();
|
|
||||||
sorted.sort();
|
|
||||||
sorted.reverse();
|
|
||||||
for (v, k) in sorted {
|
|
||||||
println!("{k:?}: {v}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -27,8 +27,8 @@ css-inline = "0.14.0"
|
|||||||
futures = "0.3.31"
|
futures = "0.3.31"
|
||||||
headers = "0.4.0"
|
headers = "0.4.0"
|
||||||
html-escape = "0.2.13"
|
html-escape = "0.2.13"
|
||||||
letterbox-notmuch = { version = "0.15.9", path = "../notmuch", registry = "xinu" }
|
letterbox-notmuch = { version = "0.15.7", path = "../notmuch", registry = "xinu" }
|
||||||
letterbox-shared = { version = "0.15.9", path = "../shared", registry = "xinu" }
|
letterbox-shared = { version = "0.15.7", path = "../shared", registry = "xinu" }
|
||||||
linkify = "0.10.0"
|
linkify = "0.10.0"
|
||||||
log = "0.4.17"
|
log = "0.4.17"
|
||||||
lol_html = "2.0.0"
|
lol_html = "2.0.0"
|
||||||
|
|||||||
@ -29,7 +29,7 @@ use serde::Deserialize;
|
|||||||
use sqlx::postgres::PgPool;
|
use sqlx::postgres::PgPool;
|
||||||
use tokio::{net::TcpListener, sync::Mutex};
|
use tokio::{net::TcpListener, sync::Mutex};
|
||||||
use tower_http::trace::{DefaultMakeSpan, TraceLayer};
|
use tower_http::trace::{DefaultMakeSpan, TraceLayer};
|
||||||
use tracing::{info, warn};
|
use tracing::info;
|
||||||
|
|
||||||
// Make our own error that wraps `anyhow::Error`.
|
// Make our own error that wraps `anyhow::Error`.
|
||||||
struct AppError(letterbox_server::ServerError);
|
struct AppError(letterbox_server::ServerError);
|
||||||
@ -142,25 +142,6 @@ async fn view_cid(
|
|||||||
Ok(inline_attachment_response(attachment))
|
Ok(inline_attachment_response(attachment))
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn view_original(
|
|
||||||
State(AppState { nm, .. }): State<AppState>,
|
|
||||||
extract::Path(id): extract::Path<String>,
|
|
||||||
) -> Result<impl IntoResponse, AppError> {
|
|
||||||
info!("view_original {id}");
|
|
||||||
let mid = if id.starts_with("id:") {
|
|
||||||
id.to_string()
|
|
||||||
} else {
|
|
||||||
format!("id:{}", id)
|
|
||||||
};
|
|
||||||
let files = nm.files(&mid)?;
|
|
||||||
let Some(path) = files.first() else {
|
|
||||||
warn!("failed to find files for message {mid}");
|
|
||||||
return Ok((StatusCode::NOT_FOUND, mid).into_response());
|
|
||||||
};
|
|
||||||
let str = std::fs::read_to_string(&path)?;
|
|
||||||
Ok(str.into_response())
|
|
||||||
}
|
|
||||||
|
|
||||||
async fn graphiql() -> impl IntoResponse {
|
async fn graphiql() -> impl IntoResponse {
|
||||||
response::Html(
|
response::Html(
|
||||||
GraphiQLSource::build()
|
GraphiQLSource::build()
|
||||||
@ -279,7 +260,6 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
get(download_attachment),
|
get(download_attachment),
|
||||||
)
|
)
|
||||||
.route("/view/attachment/{id}/{idx}/{*rest}", get(view_attachment))
|
.route("/view/attachment/{id}/{idx}/{*rest}", get(view_attachment))
|
||||||
.route("/original/{id}", get(view_original))
|
|
||||||
.route("/cid/{id}/{cid}", get(view_cid))
|
.route("/cid/{id}/{cid}", get(view_cid))
|
||||||
.route("/ws", any(start_ws))
|
.route("/ws", any(start_ws))
|
||||||
.route_service("/graphql/ws", GraphQLSubscription::new(schema.clone()))
|
.route_service("/graphql/ws", GraphQLSubscription::new(schema.clone()))
|
||||||
|
|||||||
@ -12,6 +12,6 @@ version.workspace = true
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
build-info = "0.0.40"
|
build-info = "0.0.40"
|
||||||
letterbox-notmuch = { version = "0.15.9", path = "../notmuch", registry = "xinu" }
|
letterbox-notmuch = { version = "0.15.7", path = "../notmuch", registry = "xinu" }
|
||||||
serde = { version = "1.0.147", features = ["derive"] }
|
serde = { version = "1.0.147", features = ["derive"] }
|
||||||
strum_macros = "0.27.1"
|
strum_macros = "0.27.1"
|
||||||
|
|||||||
@ -20,13 +20,6 @@ pub enum WebsocketMessage {
|
|||||||
|
|
||||||
pub mod urls {
|
pub mod urls {
|
||||||
pub const MOUNT_POINT: &'static str = "/api";
|
pub const MOUNT_POINT: &'static str = "/api";
|
||||||
pub fn view_original(host: Option<&str>, id: &str) -> String {
|
|
||||||
if let Some(host) = host {
|
|
||||||
format!("//{host}/api/original/{id}")
|
|
||||||
} else {
|
|
||||||
format!("/api/original/{id}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pub fn cid_prefix(host: Option<&str>, cid: &str) -> String {
|
pub fn cid_prefix(host: Option<&str>, cid: &str) -> String {
|
||||||
if let Some(host) = host {
|
if let Some(host) = host {
|
||||||
format!("//{host}/api/cid/{cid}/")
|
format!("//{host}/api/cid/{cid}/")
|
||||||
|
|||||||
@ -33,8 +33,8 @@ wasm-bindgen = "=0.2.100"
|
|||||||
uuid = { version = "1.13.1", features = [
|
uuid = { version = "1.13.1", features = [
|
||||||
"js",
|
"js",
|
||||||
] } # direct dep to set js feature, prevents Rng issues
|
] } # direct dep to set js feature, prevents Rng issues
|
||||||
letterbox-shared = { version = "0.15.9", path = "../shared", registry = "xinu" }
|
letterbox-shared = { version = "0.15.7", path = "../shared", registry = "xinu" }
|
||||||
letterbox-notmuch = { version = "0.15.9", path = "../notmuch", registry = "xinu" }
|
letterbox-notmuch = { version = "0.15.7", path = "../notmuch", registry = "xinu" }
|
||||||
seed_hooks = { version = "0.4.0", registry = "xinu" }
|
seed_hooks = { version = "0.4.0", registry = "xinu" }
|
||||||
strum_macros = "0.27.1"
|
strum_macros = "0.27.1"
|
||||||
gloo-console = "0.3.0"
|
gloo-console = "0.3.0"
|
||||||
|
|||||||
@ -694,8 +694,6 @@ fn render_open_header(msg: &ShowThreadQueryThreadOnEmailThreadMessages) -> Node<
|
|||||||
.collect();
|
.collect();
|
||||||
let show_x_original_to = !*to_xinu.borrow() && msg.x_original_to.is_some();
|
let show_x_original_to = !*to_xinu.borrow() && msg.x_original_to.is_some();
|
||||||
let show_delivered_to = !*to_xinu.borrow() && !show_x_original_to && msg.delivered_to.is_some();
|
let show_delivered_to = !*to_xinu.borrow() && !show_x_original_to && msg.delivered_to.is_some();
|
||||||
let host = seed::window().location().host().expect("couldn't get host");
|
|
||||||
let href = letterbox_shared::urls::view_original(Some(&host), &msg.id);
|
|
||||||
div![
|
div![
|
||||||
C!["flex", "p-4", "bg-neutral-800"],
|
C!["flex", "p-4", "bg-neutral-800"],
|
||||||
div![avatar],
|
div![avatar],
|
||||||
@ -777,36 +775,20 @@ fn render_open_header(msg: &ShowThreadQueryThreadOnEmailThreadMessages) -> Node<
|
|||||||
C!["text-right"],
|
C!["text-right"],
|
||||||
msg.timestamp
|
msg.timestamp
|
||||||
.map(|ts| div![C!["text-xs", "text-nowrap"], human_age(ts)]),
|
.map(|ts| div![C!["text-xs", "text-nowrap"], human_age(ts)]),
|
||||||
div![
|
i![C![
|
||||||
C!["p-2"],
|
"mx-4",
|
||||||
i![C![
|
"read-status",
|
||||||
"mx-4",
|
"far",
|
||||||
"read-status",
|
if is_unread {
|
||||||
"far",
|
"fa-envelope"
|
||||||
if is_unread {
|
} else {
|
||||||
"fa-envelope"
|
"fa-envelope-open"
|
||||||
} else {
|
},
|
||||||
"fa-envelope-open"
|
]],
|
||||||
},
|
ev(Ev::Click, move |e| {
|
||||||
]],
|
e.stop_propagation();
|
||||||
ev(Ev::Click, move |e| {
|
Msg::SetUnread(id, !is_unread)
|
||||||
e.stop_propagation();
|
}),
|
||||||
Msg::SetUnread(id, !is_unread)
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
div![
|
|
||||||
C!["text-xs"],
|
|
||||||
span![a![
|
|
||||||
attrs! {
|
|
||||||
At::Href=>href,
|
|
||||||
At::Target=>"_blank",
|
|
||||||
},
|
|
||||||
"View original",
|
|
||||||
ev(Ev::Click, move |e| {
|
|
||||||
e.stop_propagation();
|
|
||||||
})
|
|
||||||
]]
|
|
||||||
]
|
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -949,23 +931,20 @@ fn render_closed_header(msg: &ShowThreadQueryThreadOnEmailThreadMessages) -> Nod
|
|||||||
C!["text-right"],
|
C!["text-right"],
|
||||||
msg.timestamp
|
msg.timestamp
|
||||||
.map(|ts| div![C!["text-xs", "text-nowrap"], human_age(ts)]),
|
.map(|ts| div![C!["text-xs", "text-nowrap"], human_age(ts)]),
|
||||||
div![
|
i![C![
|
||||||
C!["p-2"],
|
"mx-4",
|
||||||
i![C![
|
"read-status",
|
||||||
"mx-4",
|
"far",
|
||||||
"read-status",
|
if is_unread {
|
||||||
"far",
|
"fa-envelope"
|
||||||
if is_unread {
|
} else {
|
||||||
"fa-envelope"
|
"fa-envelope-open"
|
||||||
} else {
|
},
|
||||||
"fa-envelope-open"
|
]],
|
||||||
},
|
ev(Ev::Click, move |e| {
|
||||||
]],
|
e.stop_propagation();
|
||||||
ev(Ev::Click, move |e| {
|
Msg::SetUnread(id, !is_unread)
|
||||||
e.stop_propagation();
|
}),
|
||||||
Msg::SetUnread(id, !is_unread)
|
|
||||||
})
|
|
||||||
],
|
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -998,7 +977,7 @@ fn message_render(msg: &ShowThreadQueryThreadOnEmailThreadMessages, open: bool)
|
|||||||
],
|
],
|
||||||
IF!(open =>
|
IF!(open =>
|
||||||
div![
|
div![
|
||||||
C!["content", "bg-white", "text-black", "p-4", "min-w-full", "w-0","overflow-x-auto", from],
|
C!["bg-white", "text-black", "p-4", "min-w-full", "w-0","overflow-x-auto", from],
|
||||||
match &msg.body {
|
match &msg.body {
|
||||||
ShowThreadQueryThreadOnEmailThreadMessagesBody::UnhandledContentType(
|
ShowThreadQueryThreadOnEmailThreadMessagesBody::UnhandledContentType(
|
||||||
ShowThreadQueryThreadOnEmailThreadMessagesBodyOnUnhandledContentType { contents ,content_tree},
|
ShowThreadQueryThreadOnEmailThreadMessagesBodyOnUnhandledContentType { contents ,content_tree},
|
||||||
@ -1102,6 +1081,7 @@ fn render_attachements(
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: add cathup_mode:bool and hide elements when true
|
||||||
#[topo::nested]
|
#[topo::nested]
|
||||||
fn thread(
|
fn thread(
|
||||||
thread: &ShowThreadQueryThreadOnEmailThread,
|
thread: &ShowThreadQueryThreadOnEmailThread,
|
||||||
@ -1192,7 +1172,13 @@ fn thread(
|
|||||||
el_ref(content_el),
|
el_ref(content_el),
|
||||||
messages,
|
messages,
|
||||||
IF!(!catchup_mode => click_to_top())
|
IF!(!catchup_mode => click_to_top())
|
||||||
]
|
],
|
||||||
|
/* TODO(wathiede): plumb in orignal id
|
||||||
|
a![
|
||||||
|
attrs! {At::Href=>api::original(&thread_node.0.as_ref().expect("message missing").id)},
|
||||||
|
"Original"
|
||||||
|
],
|
||||||
|
*/
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,23 +2,23 @@ html {
|
|||||||
background-color: black;
|
background-color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mail-thread .content a,
|
.mail-thread a,
|
||||||
.news-post a {
|
.news-post a {
|
||||||
color: var(--color-link) !important;
|
color: var(--color-link) !important;
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mail-thread .content br,
|
.mail-thread br,
|
||||||
.news-post br {
|
.news-post br {
|
||||||
display: block;
|
display: block;
|
||||||
margin-top: 1em;
|
margin-top: 1em;
|
||||||
content: " ";
|
content: " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
.mail-thread .content h1,
|
.mail-thread h1,
|
||||||
.mail-thread .content h2,
|
.mail-thread h2,
|
||||||
.mail-thread .content h3,
|
.mail-thread h3,
|
||||||
.mail-thread .content h4,
|
.mail-thread h4,
|
||||||
.news-post h1,
|
.news-post h1,
|
||||||
.news-post h2,
|
.news-post h2,
|
||||||
.news-post h3,
|
.news-post h3,
|
||||||
@ -27,12 +27,12 @@ html {
|
|||||||
margin-bottom: 1em !important;
|
margin-bottom: 1em !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mail-thread .content p,
|
.mail-thread p,
|
||||||
.news-post p {
|
.news-post p {
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mail-thread .content pre,
|
.mail-thread pre,
|
||||||
.news-post pre {
|
.news-post pre {
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
background-color: #eee !important;
|
background-color: #eee !important;
|
||||||
@ -40,28 +40,28 @@ html {
|
|||||||
white-space: break-spaces;
|
white-space: break-spaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mail-thread .content code,
|
.mail-thread code,
|
||||||
.news-post code {
|
.news-post code {
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
white-space: break-spaces;
|
white-space: break-spaces;
|
||||||
background-color: #eee !important;
|
background-color: #eee !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mail-thread .content blockquote {
|
.mail-thread blockquote {
|
||||||
padding-left: 1em;
|
padding-left: 1em;
|
||||||
border-left: 2px solid #ddd;
|
border-left: 2px solid #ddd;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mail-thread .content ol,
|
.mail-thread ol,
|
||||||
.mail-thread .content ul {
|
.mail-thread ul {
|
||||||
margin-left: 2em;
|
margin-left: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mail-thread .content .noreply-news-bloomberg-com a {
|
.mail-thread .noreply-news-bloomberg-com a {
|
||||||
background-color: initial !important;
|
background-color: initial !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mail-thread .content .noreply-news-bloomberg-com h2 {
|
.mail-thread .noreply-news-bloomberg-com h2 {
|
||||||
margin: 0 !important;
|
margin: 0 !important;
|
||||||
padding: 0 !important;
|
padding: 0 !important;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user