refactor(tasks): omit empty descriptions

preparation for state update notes
This commit is contained in:
xeruf 2024-11-21 10:56:52 +01:00
parent fc97b513c4
commit 5032b4db93
1 changed files with 3 additions and 5 deletions

View File

@ -98,7 +98,8 @@ impl Task {
/// Description items, ordered newest to oldest
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 {
@ -222,10 +223,7 @@ impl Task {
.map(|e| format!("{} kind {} \"{}\"", e.created_at, e.kind, e.content))
.collect_vec()
)),
"descriptions" => Some(format!(
"{:?}",
self.descriptions().collect_vec()
)),
"descriptions" => Some(format!("{:?}", self.descriptions().collect_vec())),
_ => {
warn!("Unknown task property {}", property);
None