From f4cff3d702691cade4e23612b085135fa3d3d897 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Mon, 19 Aug 2024 21:41:45 +0300 Subject: [PATCH] feat: use author name consistently --- src/main.rs | 5 +++-- src/tasks.rs | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 9a7ae26..d285ad8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -379,11 +379,12 @@ async fn main() { } Some('@') => { - let author = arg.and_then(|a| PublicKey::from_str(a).ok()).unwrap_or_else(|| keys.public_key()); + let key = arg.and_then(|a| PublicKey::from_str(a).ok()).unwrap_or_else(|| keys.public_key()); + let author = tasks.get_author(&key); info!("Filtering for events by {author}"); tasks.set_filter( tasks.filtered_tasks(tasks.get_position_ref()) - .filter(|t| t.event.pubkey == author) + .filter(|t| t.event.pubkey == key) .map(|t| t.event.id) .collect() ) diff --git a/src/tasks.rs b/src/tasks.rs index 95bb8f0..08ce899 100644 --- a/src/tasks.rs +++ b/src/tasks.rs @@ -214,11 +214,11 @@ impl Tasks { } else { format_stamp(end, "%H:%M") }, - key)) + self.get_author(key))) } iter.into_buffer() .for_each(|(stamp, _)| - vec.push(format!("{} started by {}", local_datetimestamp(stamp), key))); + vec.push(format!("{} started by {}", local_datetimestamp(stamp), self.get_author(key)))); vec }).sorted_unstable(); // TODO sorting depends on timestamp format - needed to interleave different people (format!("Times Tracked on {:?}", self.get_task_title(&id)), Box::from(history))