Repository navigation
Refactor version comparison - #2878
Conversation
06e7b8f to
8b59a44
Compare
hweihwang
left a comment
There was a problem hiding this comment.
Thanks Jonas, much less code to carry, and on 36 it works well for me. Two things, not blocking:
- Comparing with the current version no longer saves the editor first, so the last seconds of typing can be missing from "Current version". Keeping the save before comparing would cover it.
- On 35, attachments may not load in the comparison: Collectives passes
fileId, while Text stable35 readsOCA.Viewer.fileInfo.fileid. I only checked this in the code, not on a 35 instance.
Text shows the differences between two Markdown versions in the viewer now, so the comparison dialog of its own is no longer needed. Comparing a version with the current one opens the viewer again. This removes the comparison dialog with its snapshot loading, caching and size limits, as well as the shareable comparison links. Links with `compareFrom` and `compareTo` open the page without a comparison now. Kept from the previous implementation: * the versions tab for members without edit permissions * reloading the versions when the page timestamp changes * ignoring outdated versions responses The tests for the removed code and the separate CI setup for them are removed as well. The Cypress page versions tests are back to the lean version from before. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Jonas <jonas@freesources.org>
The versions tab gets a "Compare versions…" button that opens a dialog to pick any two versions of the page. The viewer then shows their differences, using the earlier version as base. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Jonas <jonas@freesources.org>
Also covers comparing two selected versions. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Jonas <jonas@freesources.org>
Nodes of `@nextcloud/files` take decoded sources and encode them for requests. The versions store has encoded sources, so comparing versions of pages with special characters in the name requested a double encoded URL and failed to load the current version. Signed-off-by: Jonas <jonas@freesources.org> Assisted-by: ClaudeCode:claude-opus-5-5
…o it The viewer asks for the sidebar whenever it shows a file while an app sidebar is visible, e.g. when comparing versions from the versions tab. Only switch to the attachments tab when the sidebar wasn't open yet. Signed-off-by: Jonas <jonas@freesources.org> Assisted-by: ClaudeCode:claude-opus-5-5
The Text comparison in the viewer loads the two versions only once. Comparing other versions while a comparison is still open replaced the files in the open viewer, but Text kept waiting for them to load and the viewer showed its spinner forever. Closing the viewer first makes Text load the newly compared versions. Signed-off-by: Jonas <jonas@freesources.org> Assisted-by: ClaudeCode:claude-opus-5-5
The viewer titled a comparison with the file names: the page's Markdown file and the numeric id of the version. The compared versions carry the names the versions tab shows now: current version, the version's label, initial version or the date. Signed-off-by: Jonas <jonas@freesources.org> Assisted-by: ClaudeCode:claude-opus-5-5
8b59a44 to
150444d
Compare
The editor autosave might have a delay of up to 10 seconds, so comparing the current version could miss the latest changes. The versions tab asks the editor to save first, through an event like the one the attachments tab uses to reach it. If saving fails, an error says so and the comparison shows the last saved version. Signed-off-by: Jonas <jonas@freesources.org> Assisted-by: ClaudeCode:claude-opus-5-5
150444d to
d801b06
Compare
|
Thanks Hoang!
I first thought that we can leave this out as the new autosave logic in text is pretty good. But then I thought about it again and agree that now that we're on it, it's worth to fix this also straight away. There's the possibility of a delay of up to 10 seconds in autosave, so it's worth to save manually before comparing with current version. Fixed now.
Indeed, good catch. Also fixed and a test added now. |
On Nextcloud 35 and older, Text takes the file to resolve attachments of the compared versions from the Viewer app's file info, by `fileid` and `filename`. The versions passed have neither, so images in the compared versions did not load. Pass the page's id and path along. Signed-off-by: Jonas <jonas@freesources.org> Assisted-by: ClaudeCode:claude-opus-5-5
d801b06 to
ead8273
Compare
📝 Summary
Follow-up to #2699 and #2700.
This replaces the version comparison added in #2699 and #2700 with a much smaller implementation, similar to what nextcloud/text#9293 did for Text. Text now shows the differences between two Markdown versions in the viewer itself, so Collectives no longer needs a comparison dialog of its own.
Removed, as Text and the viewer handle it now or it isn't needed:
compareFrom/compareTo).semantic-e2ematrix entries, extra Playwright projects, Cypress flags)Fixed along the way:
🚧 TODO
🏁 Checklist
npm run lint/npm run stylelint/composer run cs:check)🤖 AI (if applicable)