Repository navigation
feat(app): add version history and restore for items - #166
Merged
Merged
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.
Summary
A person can now open an earlier version of a note, read it beside the note as it is now, and restore it. Version History is a sheet from the File menu, an item's context menu, the More menu, the command palette and the page's context menu. Restoring is a new edit on the current version, so the text it replaces stays in the item's history and Undo puts it back.
Changes
Listof versions, two read-only text panes, the version's other fields, Restore), opened fromNoteOrganizeActions(so the File menu, lists and the More menu), the board's menu, the palette and the page's context menu.ItemHistorySource, a seam forGET /items/{id}/versions.MarfaServerVersionsimplements it over the package'sMarfaAPIclient, injected throughMarfaHostintoMarfaLibrary. The view model (ItemHistoryModel) and the sheet never see the generated client.MarfaLibrary.restoreVersionrestores the title and the text through the normal edit path: the text throughsaveTexton the version the library holds, the title througheditProperties, with an undo registered like Change Type's.Model/AGENTS.mdandModel/Marfa/AGENTS.mddescribe the feature, and the ATS line that said MAPP never usesURLSessionis corrected. Strings are hand-appended to the String Catalog.Testing
Unitplan passes (run once after the last change, and the new suites again after rebasing ontomain).VersionHistoryTests.swift) use a fakeItemHistorySourceandFakeItemSource: gaps and repeats in version numbers, an empty page that still has a cursor, a cursor that loops, paging one page at a time, offline and no-permission failures with Try Again, a failed Load More keeping the list, no history source, a cut-off long text, restore refused for an item in the bin, one deleted elsewhere, and a version of a kind MAPP does not edit, restoring a version already current (no write), the edit and the undo, and Undo refusing when the text was typed over since.Liveplan was not run), and no window was opened, so the sheet's layout and the menus are checked by reading the code only. The ATS behaviour for a plain-http address, and the page's refresh after a restore while its editor is open, were not tried.Notes for reviewers
sinceoption on the endpoint would let the sheet open on the latest versions of a long history; worth an issue on marfa, not filed.URLSession, unlike the working copy, so App Transport Security applies to a plain-http server address that ATS does not exempt. Documented inModel/Marfa/AGENTS.md.MarfaLibrary+Writing.swiftdeserve the closest read.Checklist