feat(workspace): trash for notes
Deleting a note (or its folder) moves it to the trash instead of erasing it. Trashed notes leave the tree, search, export and stats and are hidden from everyone they were shared with; the owner sees them read-only with a restore banner. New endpoints list, restore, purge and empty the trash; restoring recreates a deleted folder. Sidebar entry and mobile menu item with counter, list view with two-tap permanent delete. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
344f5e4ab2
commit
f69f74fdc7
15 files changed
+649
-40
No files matched your search
@@ -429,14 +429,16 @@ func TestFolderManagementAndDeletion(t *testing.T) {
|
||||
t.Fatalf("expected 2 deleted docs, got %d (%v)", len(deletedDocs), deletedDocs)
|
||||
}
|
||||
|
||||
// Verify docs are gone from DB
|
||||
_, err = store.GetDocumentByID(user.ID, doc1.ID)
|
||||
if err == nil {
|
||||
t.Fatalf("expected doc1 to be deleted")
|
||||
// The notes are in the trash now, no longer in the tree
|
||||
trash, _ := store.GetTrash(user.ID)
|
||||
if len(trash) != 2 {
|
||||
t.Fatalf("expected doc1 and doc2 in the trash, got %v", trash)
|
||||
}
|
||||
_, err = store.GetDocumentByID(user.ID, doc2.ID)
|
||||
if err == nil {
|
||||
t.Fatalf("expected doc2 to be deleted")
|
||||
docs, _ := store.GetDocuments(user.ID)
|
||||
for _, d := range docs {
|
||||
if d.ID == doc1.ID || d.ID == doc2.ID {
|
||||
t.Fatalf("trashed note %s still in the tree", d.ID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user