Skip to content

feat(notes): delete a note with Undo, and put it back from Recently deleted - #409

Merged
adeelahmad merged 4 commits into
mainfrom
claude/project-thread-wm7xc9
Oct 15, 2026
Merged

adeelahmad merged 4 commits into
mainfrom
claude/project-thread-wm7xc9

Conversation

@adeelahmad

Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

Before: deleting a note asked "Delete this page?" first and then removed it for good, with its files and history. A wrong click could not be undone.

After: Delete deletes at once and the notice has Undo, which puts the note back where it was and opens it. Deleted notes wait in Recently deleted at the bottom of the Notes page for 30 days, with their files and history: Put back returns one with the notes that were inside it, and Delete now (clicked twice) removes it for good. After 30 days they go on their own.

How: notebook.delete moves the page to a new note_trash table under its own id (notes inside move up a level and remember where they were); restore moves it back; the notes pass (organise_due) purges pages older than TRASH_DAYS. New routes: GET /api/v1/notes/deleted?ns=, POST /api/v1/notes/deleted/{pid}/restore, DELETE /api/v1/notes/deleted/{pid} (editors). Web: components/notes/delete.ts (delete with an Undo toast) and recently-deleted.tsx.

Motivation and Context

Second gap from the notes UI audit (Adeel: "notes ui is very bad and is missing tons of things"); AGENTS.md asks for undo instead of confirm dialogs.

Steps to reproduce (if appropriate):

Open a note → Delete → the toast says it was deleted → Undo → the note is back. Delete it again → Notes page → Recently deleted → Put back.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change; ! in the title)

Checklist:

  • The title is a Conventional Commit.
  • My code follows the code style of this project (make hooks checks it on commit).
  • I added or updated tests.
  • My change requires documentation updates, and I have updated docs/ accordingly.
  • Users need more than the title to understand it, so I wrote it under ## Unreleased in CHANGELOG.md.

Done questions (AGENTS.md)

  • Goal: a deleted note can be put back, from the toast or Recently deleted; merged on green CI.
  • Agents: the three routes above; the assistant still never deletes notes.
  • Zero setup: nothing to install or configure; the table is created at start.
  • Fewest clicks: one click to delete, one to undo; no confirm dialog.
  • Configurable: n/a, 30 days is fixed for now (refine later: a setting if anyone asks).
  • Light: no new dependency.
  • Private and secure: same namespace and editor checks as deleting; deleted notes stay on the user's hardware and are listed only to members. No new external surface.
  • Cost: no model calls.
  • User decides: nothing is lost without a click; after 30 days the purge does what Delete used to do at once.
  • Upgrades: a new note_trash table (DEFINE … IF NOT EXISTS, safe to run twice); existing notes don't change.
  • Honest: docs describe what is built.
  • Tests (backend delete/restore/purge, web delete with Undo and Recently deleted), docs (docs/notes.md, docs/api.md) and generated files (make openapi) updated. Local: backend 1091 passed, web 890 passed.
  • Open standards: n/a.
  • Refine later: the retention could become a setting; a deleted note's links show without a name until it's back.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RrY2byt5BHVeBXJUyfwWpb


Generated by Claude Code

…eleted

Deleting a note no longer asks first: it goes to note_trash under its own id for 30
days, with its files and history, and the notice's Undo puts it back where it was,
with the notes that were inside it. The Notes page lists recently deleted notes to put
back or delete for good; the notes pass empties ones older than 30 days.
GET /notes/deleted, POST /notes/deleted/{pid}/restore, DELETE /notes/deleted/{pid}.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RrY2byt5BHVeBXJUyfwWpb
@adeelahmad adeelahmad self-assigned this Oct 15, 2026
…-wm7xc9

# Conflicts:
#	CHANGELOG.md
#	nextjs-frontend/components/notes/note-page.tsx
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RrY2byt5BHVeBXJUyfwWpb
@adeelahmad
adeelahmad merged commit 5eb0aed into main Oct 15, 2026
10 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-wm7xc9 branch October 15, 2026 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants