web: handle empty subjects
This commit is contained in:
parent
fc7a4a747c
commit
1ac7f5b6dc
@ -135,6 +135,11 @@ fn view_search_results(
|
|||||||
if let Some(idx) = unread_idx {
|
if let Some(idx) = unread_idx {
|
||||||
tags.remove(idx);
|
tags.remove(idx);
|
||||||
};
|
};
|
||||||
|
let subject = if r.subject.is_empty() {
|
||||||
|
"(no subject)"
|
||||||
|
} else {
|
||||||
|
&r.subject
|
||||||
|
};
|
||||||
tr![
|
tr![
|
||||||
IF!(unread_idx.is_some() => C!["unread"]),
|
IF!(unread_idx.is_some() => C!["unread"]),
|
||||||
td![label![
|
td![label![
|
||||||
@ -181,7 +186,7 @@ fn view_search_results(
|
|||||||
attrs! {
|
attrs! {
|
||||||
At::Href => urls::thread(&tid)
|
At::Href => urls::thread(&tid)
|
||||||
},
|
},
|
||||||
&r.subject,
|
&subject,
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
td![
|
td![
|
||||||
@ -441,7 +446,7 @@ fn render_open_header(msg: &ShowThreadQueryThreadMessages) -> Node<Msg> {
|
|||||||
table![
|
table![
|
||||||
IF!(!msg.to.is_empty() =>
|
IF!(!msg.to.is_empty() =>
|
||||||
tr![
|
tr![
|
||||||
td![ "To" ],
|
td![ "To:" ],
|
||||||
//td![ if i==0 { "To" }else { "" } ],
|
//td![ if i==0 { "To" }else { "" } ],
|
||||||
td![
|
td![
|
||||||
msg.to.iter().enumerate().map(|(i, to)|
|
msg.to.iter().enumerate().map(|(i, to)|
|
||||||
@ -467,7 +472,7 @@ fn render_open_header(msg: &ShowThreadQueryThreadMessages) -> Node<Msg> {
|
|||||||
]),
|
]),
|
||||||
IF!(!msg.cc.is_empty() =>
|
IF!(!msg.cc.is_empty() =>
|
||||||
tr![
|
tr![
|
||||||
td![ "CC" ],
|
td![ "CC:" ],
|
||||||
td![
|
td![
|
||||||
msg.cc.iter().enumerate().map(|(i, cc)|
|
msg.cc.iter().enumerate().map(|(i, cc)|
|
||||||
small![
|
small![
|
||||||
@ -656,7 +661,12 @@ fn message_render(msg: &ShowThreadQueryThreadMessages, open: bool) -> Node<Msg>
|
|||||||
#[topo::nested]
|
#[topo::nested]
|
||||||
fn thread(thread: &ShowThreadQueryThread, open_messages: &HashSet<String>) -> Node<Msg> {
|
fn thread(thread: &ShowThreadQueryThread, open_messages: &HashSet<String>) -> 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);
|
let subject = if thread.subject.is_empty() {
|
||||||
|
"(no subject)"
|
||||||
|
} else {
|
||||||
|
&thread.subject
|
||||||
|
};
|
||||||
|
set_title(subject);
|
||||||
let mut tags: Vec<_> = thread
|
let mut tags: Vec<_> = thread
|
||||||
.messages
|
.messages
|
||||||
.iter()
|
.iter()
|
||||||
@ -675,7 +685,7 @@ fn thread(thread: &ShowThreadQueryThread, open_messages: &HashSet<String>) -> No
|
|||||||
let unread_thread_id = thread.thread_id.clone();
|
let unread_thread_id = thread.thread_id.clone();
|
||||||
div![
|
div![
|
||||||
C!["thread"],
|
C!["thread"],
|
||||||
h3![C!["is-size-5"], &thread.subject],
|
h3![C!["is-size-5"], subject],
|
||||||
span![C!["tags"], tags_chiclet(&tags, false)],
|
span![C!["tags"], tags_chiclet(&tags, false)],
|
||||||
span![
|
span![
|
||||||
// TODO(wathiede): add "Mark as spam"
|
// TODO(wathiede): add "Mark as spam"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user