fix(main): do not create empty notes

This commit is contained in:
xeruf 2024-11-23 12:11:31 +01:00
parent 7ecfa6e810
commit b26d64646c
2 changed files with 4 additions and 5 deletions

View File

@ -417,8 +417,8 @@ async fn main() -> Result<()> {
} }
} }
Some(arg) => { Some(arg) => {
if arg.len() < CHARACTER_THRESHOLD { if arg.trim().len() < 2 {
warn!("Note needs at least {CHARACTER_THRESHOLD} characters!"); warn!("Needs at least 2 characters!");
continue 'repl; continue 'repl;
} }
tasks.make_note(arg); tasks.make_note(arg);

View File

@ -1316,9 +1316,8 @@ impl TasksRelay {
let (name, tags) = extract_tags(note.trim()); let (name, tags) = extract_tags(note.trim());
let format = format!("\"{name}\" with tags [{}]", join_tags(&tags)); let format = format!("\"{name}\" with tags [{}]", join_tags(&tags));
let mut prop = let mut prop =
EventBuilder::new(Kind::TextNote, name).tags(tags); EventBuilder::new(Kind::TextNote, name)
//.filter(|id| self.get_by_id(id).is_some_and(|t| t.is_task())) .tags(tags);
//.map(|id|
let marker = let marker =
if self.get_current_task().is_some_and(|t| t.is_task()) { if self.get_current_task().is_some_and(|t| t.is_task()) {
MARKER_PROPERTY MARKER_PROPERTY