Skip to content

Add API endpoint to delete private notes#261

Open
josephsellers wants to merge 2 commits intoabhinavxd:mainfrom
josephsellers:delete-private-notes
Open

Add API endpoint to delete private notes#261
josephsellers wants to merge 2 commits intoabhinavxd:mainfrom
josephsellers:delete-private-notes

Conversation

@josephsellers
Copy link
Copy Markdown
Contributor

Summary

Adds DELETE /api/v1/conversations/{cuuid}/messages/{uuid} for removing private notes via the API. Only messages with private=true can be deleted; the SQL WHERE clause ensures sent messages are protected. Returns 404 if the message doesn't exist or isn't private.

This is useful for API consumers that create private notes programmatically and need to clean them up (e.g. replacing an outdated note before adding a new one).

Changes

  • cmd/messages_delete.go: New handler (handleDeleteMessage) with conversation access enforcement
  • internal/conversation/message_delete.go: New DeleteMessage method on the conversation manager
  • cmd/handlers.go: Route registration (DELETE, messages:write permission)
  • internal/conversation/conversation.go: DeleteMessage prepared statement in query struct
  • internal/conversation/queries.sql: delete-message query

Test plan

  • Create a private note via POST /conversations/{uuid}/messages with private: true
  • Delete it via DELETE /conversations/{cuuid}/messages/{uuid}
  • Verify it returns success and the note is gone
  • Attempt to delete a non-private (sent) message
  • Verify it returns 404 (protected by SQL constraint)
  • Attempt to delete a message from a conversation the agent doesn't have access to
  • Verify it returns a permission error

Adds DELETE /api/v1/conversations/{cuuid}/messages/{uuid} for removing
private notes via the API. Only messages with private=true can be
deleted — the SQL WHERE clause ensures sent messages are protected.
Returns 404 if the message doesn't exist or isn't private.

Useful for API consumers that create private notes programmatically
and need to clean them up (e.g. replacing an outdated note before
adding a new one).

[Used Claude Code 🤖]
@abhinavxd
Copy link
Copy Markdown
Owner

abhinavxd commented Mar 9, 2026

Thanks for the PR!

We should have a context menu option (right click on private note) to delete it that hits this API.

Right-clicking a private note shows a "Delete note" option that calls
the DELETE endpoint and removes the note from the UI. Non-private
messages are unaffected (browser default context menu).

[Used Claude Code 🤖]
@josephsellers
Copy link
Copy Markdown
Contributor Author

Added a context menu for private notes in the conversation view. Right-clicking a private note shows a "Delete note" option (with trash icon, destructive styling). Non-private messages are unaffected.

Changes:

  • MessageBubble.vue: wraps bubble in ContextMenu, trigger disabled for non-private messages
  • api/index.js: deleteMessage function
  • stores/conversation.js: deleteMessage action (API call, cache removal, error toast)
  • conversation-message-cache.js: removeMessage method
  • i18n/en.json: conversation.deletePrivateNote key

@josephsellers
Copy link
Copy Markdown
Contributor Author

P.S. Sorry for the big diff on MessageBubble.vue. I think the logic is sound, but the indentation changed making a 15 line change look massive.

@abhinavxd
Copy link
Copy Markdown
Owner

Hey, thanks for the PR! I will merge this as soon as I merge - #114

#114 PR adds the live chat widget, which required me to refactor and move many parts of the project. Since everything would need to be retested anyway, I ended up bundling in a lot of other fixes as well to avoid multiple rounds of QA.

@abhinavxd
Copy link
Copy Markdown
Owner

Hey there seems to be conflict due to recent live chat branch merge

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