forked from janek/mostr
refactor(tasks): omit empty descriptions
preparation for state update notes
This commit is contained in:
parent
fc97b513c4
commit
5032b4db93
1 changed files with 3 additions and 5 deletions
|
@ -98,7 +98,8 @@ impl Task {
|
||||||
|
|
||||||
/// Description items, ordered newest to oldest
|
/// Description items, ordered newest to oldest
|
||||||
pub(crate) fn descriptions(&self) -> impl DoubleEndedIterator<Item=&String> + '_ {
|
pub(crate) fn descriptions(&self) -> impl DoubleEndedIterator<Item=&String> + '_ {
|
||||||
self.description_events().map(|e| &e.content)
|
self.description_events()
|
||||||
|
.filter_map(|e| Some(&e.content).take_if(|s| !s.trim().is_empty()))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn is_task_kind(&self) -> bool {
|
pub(crate) fn is_task_kind(&self) -> bool {
|
||||||
|
@ -222,10 +223,7 @@ impl Task {
|
||||||
.map(|e| format!("{} kind {} \"{}\"", e.created_at, e.kind, e.content))
|
.map(|e| format!("{} kind {} \"{}\"", e.created_at, e.kind, e.content))
|
||||||
.collect_vec()
|
.collect_vec()
|
||||||
)),
|
)),
|
||||||
"descriptions" => Some(format!(
|
"descriptions" => Some(format!("{:?}", self.descriptions().collect_vec())),
|
||||||
"{:?}",
|
|
||||||
self.descriptions().collect_vec()
|
|
||||||
)),
|
|
||||||
_ => {
|
_ => {
|
||||||
warn!("Unknown task property {}", property);
|
warn!("Unknown task property {}", property);
|
||||||
None
|
None
|
||||||
|
|
Loading…
Add table
Reference in a new issue