Repository navigation
Delete operations, one or several, with undo and a trash - #17
Merged
Merged
Conversation
Operations could only be marked "not spending"; a wrong Wallet payment, a manual entry made by mistake or a statement operation the person does not want could not be removed. Now the ✎ menu of every operation has Delete, and Select on the operations page picks several to delete at once. A deleted operation goes to the trash whole (migration 0010): its fields, its category parts and the keys of the statement operations it came from. So: - the message after deleting offers Undo, and Deleted operations lists them to restore one, several or all; restored operations get new ids, since ClickHouse has deleted the old ones; - importing the statement again, or a newer version of it, does not bring a deleted operation back (by key, or by content like a live twin), and the import result says how many were left out; a Wallet payment sent again with the same key is not added either; - reconciliation still counts deleted statement operations, as the bank did, and says so; - merging categories updates the parts kept in the trash. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Operations could only be marked "Not spending". A wrong Wallet payment, a manual entry made by mistake, or a statement operation the person does not want could not be removed.
What changed
/ui/trash, linked from the operations page) lists them and restores one, several or all.0010_trash.sql): a deleted operation is kept whole: its fields, its category parts (trash_splits) and its statement operation keys (trash_links). Then it is removed fromtransactions. The cascade removes its parts, questions and links, and the existing trigger tells ClickHouse.ImportTwinsnow finds deleted twins too.InsertTxreports a duplicate with id 0).Checks
gofmt -l .prints nothing;go vet ./...passes;go test -race ./...passes;CLICKHOUSE_TEST_URL=… go test ./...passes;golangci-lint run ./...reports 0 issues.TestTrash(store): parts, Wallet resend, category merge, list, restore.TestDeletedStaysDeleted(importer): re-import, a newer version, reconciliation, restore.TestDeleteOperations(web): one, Undo, select mode, several, the trash page, nothing picked, unsafe back./ui/trashand/ui/operations?select=1are added toTestPagesRender.🤖 Generated with Claude Code