feat: undo and redo for message actions - #102
Open
r4nc0r wants to merge 1 commit into
Open
Conversation
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.
Adds an Outlook-style undo/redo history for message actions, on Ctrl+Z / Ctrl+Y and on a pair of main-toolbar buttons, the undo one carrying a dropdown of the history.
Every mutation in grommunio-web is an immediate server round-trip, so there is nothing to roll back locally: undo is performed as a compensating server operation, e.g. undoing a delete moves the item back out of the wastebasket. Actions are captured centrally off the
IPMStoreMgrsave events rather than at each call site, so a gesture is recorded wherever it is triggered from.Because moving a message gives it a new entryid, captured delete/move/copy operations ask the server to report the new location by attaching a
track_new_entryidsmessage action; the server answers with anundoobject in the success feedback, whichProxyResponseHandlerputs on the record. The server resolves the moved items by their move-stable search keys, taking note of which items already sat in the destination beforehand so they are not mistaken for the ones just moved.What is undoable
Deleting, moving and copying messages; creating an appointment; and plain property changes, which covers read/unread, flags, categories and dragging or resizing an appointment. A property change is captured generically by snapshotting every modified field, so it needs no per-feature wiring.
Deliberately never recorded: anything that sends mail (replies, forwards, meeting requests, cancellations, responses, task requests, snooze and dismiss), since it cannot be unsent; soft deletes; and occurrences of a recurring series, which are saved as exceptions inside the series rather than as items of their own. Creating anything other than an appointment is also skipped — drafts save repeatedly while composing and would flood the history.
The history holds 20 entries. An operation the server never confirms is dropped after a minute rather than left to be undone against a state that never happened.
Interface
Clicking an entry of the history undoes every action down to it, not only that one, so hovering an entry marks the whole range which would go — without that the menu reads as though a single older action could be picked out. The commands run one after another; one which fails is reported and dropped, and the rest still run.
Server
ItemModulegrew the tracking for delete and copy/move,Operationsthe search-key helpers behind it, andTaskItemModulea small change alongside. No new module and no new action: the tracking rides on the existing save and delete actions and only does anything when the client asks for it.