MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / moveNoteToTrash

Function moveNoteToTrash

integrations/raycast/src/search-notes.tsx:338–370  ·  view source on GitHub ↗
(
  note: ZenNote,
  onDelete: (path: string) => void,
)

Source from the content-addressed store, hash-verified

336}
337
338async function moveNoteToTrash(
339 note: ZenNote,
340 onDelete: (path: string) => void,
341): Promise<void> {
342 const confirmed = await confirmAlert({
343 title: `Move "${note.title}" to Trash?`,
344 message: note.path,
345 primaryAction: {
346 title: "Move to Trash",
347 style: Alert.ActionStyle.Destructive,
348 },
349 });
350 if (!confirmed) return;
351
352 const toast = await showToast({
353 style: Toast.Style.Animated,
354 title: "Moving note to Trash",
355 message: note.title,
356 });
357
358 try {
359 await execZen(["trash", note.path, "--json"]);
360 onDelete(note.path);
361 toast.style = Toast.Style.Success;
362 toast.title = "Moved to Trash";
363 toast.message = note.title;
364 } catch (err) {
365 const loadError = toLoadError(err);
366 toast.style = Toast.Style.Failure;
367 toast.title = loadError.title;
368 toast.message = loadError.message;
369 }
370}
371
372function noteKeywords(note: ZenNote): string[] {
373 return [note.path, note.folder, ...note.tags.map((tag) => `#${tag}`)];

Callers 3

handlerFunction · 0.85
ArchiveViewFunction · 0.85
NoteActionsFunction · 0.85

Calls 2

execZenFunction · 0.90
toLoadErrorFunction · 0.90

Tested by

no test coverage detected