Repository navigation
feat(messages): reversible message actions with undo - #310
Merged
hieunc229 merged 16 commits intoNov 18, 2026
Merged
Conversation
Batch apply and undo CAS writes under D1's query and parameter limits, check every field an action writes, and fall back per row only for raced rows. Also remove dead helpers, redundant comments and the unused star-route payload so the branch diff stays focused.
This was referenced Nov 14, 2026
Owner
|
Nice one @antonio-ivanovski, I just move the toast close to the screen's left side and align the toast for sending message at the same position |
Contributor
Author
Makes sense - my idea was to have it closer to the design of gmail but having it unified to all toasts makes sense. |
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.
Summary
Adds a shared reversible-action layer with an Undo toast, so explicit message changes can be taken back from wherever they were made.
How it works
POST /api/messages/actionsapplies an action and returns a signed token plus the exact before/after state of every message it actually changed.{ "op": "undo" }restores from that token.message_action_undo_claimstable makes each token single-use: the claim is written first, kept once any row commits, and released only on a zero-progress failure so an otherwise safe retry can succeed.CASESET for values that differ, chunked under D1's bound-parameter limit. MySQL writes per row because itsRETURNINGshim can over-report a concurrently changed batch.Migrations
Adds
message_action_undo_claimsin all three dialects:drizzle/migrations/0088_message_action_undo_claims.sqldrizzle/migrations-pg/0012_message_action_undo_claims.sqldrizzle/migrations-mysql/0012_message_action_undo_claims.sqlMigration bundles are regenerated and committed. The claims table is registered as internal and deliberately excluded from backups: restoring a stale claim would let an already-used undo token replay. For local D1, apply it with:
Testing
tsc --noEmit: clean.main(pt-BR missingaccount.apps, two overflow/layout checks, sender-check notice, MX replacement, group divider, locale SSR).tests/e2e/message-undo.spec.ts.undo-actions.webm
The recording shows a single archive, a bulk archive, and a reader star all being undone.