feat(telegram): confirmed edit/delete/undo on transactions#42
Merged
Conversation
Reply to a transaction (or tap the new [✏️ Edit]/[🗑 Delete] buttons) to edit or delete it behind a Yes/No confirmation; `undo` now confirms too instead of deleting silently. Works for both expenses and income. - New txn: callback namespace (dependency-free grammar in txnCallback.ts) and a transactionActions.ts flow module that centralizes delete/restore/edit + the confirm prompts and keyboards. - TransactionReplyProcessor (post-parse) routes a reply to a delete or edit confirm using the already-parsed reply; TransactionActionProcessor (pre-parse) handles every txn: tap, resolving the prompt in place with a toast and an [↩️ Undo] restore button. - UndoProcessor now resolves the latest entry and confirms; the delete + budget summary moved into transactionActions (shared with reply/undo). - Income parity: add Income.confirmationMessageId (migration) + repo methods; capture/store the confirmation message id in IncomeProcessor. Expense/income repos gain update() + restore()/restoreByBatchId(). Edit re-derives the bucket via resolveExpenseCategory extracted from recordExpense. - Messaging: sendInteractiveMessage gains reply threading; acknowledgeInteraction gains toast text; the controller acks after handling to surface the toast. Migration prisma/migrations/*_add_income_confirmation_message_id created offline (not applied) — run migrate deploy in the target environment. Tests: added TransactionReply/TransactionAction specs, rewrote UndoProcessor for the confirm-first behavior; 129 unit tests pass. build + lint green. Co-Authored-By: Claude Opus 4.8 (1M context) <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.
What & why
Adds the ability to edit, delete, and undo transactions from Telegram, each behind a Yes/No confirmation (previously
undodeleted silently and there was no edit at all). Works for both expenses and income.How it works
One confirm→act pipeline, several entry points:
delete/remove/…) → delete confirm; a correction (250,groceries,250 groceries) → before→after edit confirm.[✏️ Edit]/[🗑 Delete]buttons under every expense/income confirmation ([🗑 Delete all]on batch summaries).undonow asks to confirm.[↩️ Undo]restore button.Key pieces
txn:callback namespace (dependency-freetxnCallback.ts) +transactionActions.tsflow module centralizing delete/restore/edit + prompts.TransactionReplyProcessor(post-parse) andTransactionActionProcessor(pre-parse);UndoProcessornow resolves the latest entry and confirms.Income.confirmationMessageIdmigration + repo methods; expense/income repos gainupdate()+restore()/restoreByBatchId(). Edit re-derives the bucket viaresolveExpenseCategoryextracted fromrecordExpense.answerCallbackQuery; controller acks after handling.prisma/migrations/*_add_income_confirmation_message_idis committed but not applied — runprisma migrate deployin the target environment before/at deploy.Verification
pnpm build✅ ·pnpm lint✅ ·pnpm test:unit129 passed (added specs for both new processors; rewrote UndoProcessor spec for confirm-first).🤖 Generated with Claude Code