Skip to content

feat(comparison): change the versions compared - #9532

Draft
hweihwang wants to merge 1 commit into
fix/comparison-closing-savefrom
feat/comparison-version-picker
Draft

hweihwang wants to merge 1 commit into
fix/comparison-closing-savefrom
feat/comparison-version-picker

Conversation

@hweihwang

@hweihwang hweihwang commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

📝 Summary

The comparison from #9293 shows the two versions Files passed in, and Collectives too since nextcloud/collectives#2878 (not released yet). To compare other versions, you had to close it and start again from the Versions tab.

Now each document title side by side, and the "From … to …" line above the list of changes, is a version picker:

  • It lists the current file and the retained versions, newest first, with author and label.
  • Choices that would put the newer version first are disabled and say why. The current file always counts as the newest, also after restoring a version set its time back.
  • Each picker names its version by when it was saved, with seconds where both ends fall in one minute. For the current file that is when the text compared was saved, so every view names it the same.
  • Choosing one keeps the view and the other end, tells screen readers which versions are now compared, and gives the keyboard back to the picker once the new pair has loaded.
  • Links and images in the documents resolve from the file's folder, also when an older version is the newer end.
  • When a version cannot be loaded, or the editor the comparison replaced could not save, it says which and offers the pickers and "Try again".

The versions come from a new OCS endpoint, GET /ocs/v2.php/apps/text/versions/{fileId}, fetched the first time a menu opens and kept until the viewer closes; "Refresh versions" and a failed load fetch them again. It answers only for a readable Markdown file in the user's own files that is not end-to-end encrypted, and lists what the Versions tab shows; every refusal is the same 404. Without Files Versions it lists only the current file. Public share pages get no picker.

Screenshots and a video of the whole flow are in the last PR of the stack.

🏁 Checklist

  • Code is properly formatted (npm run lint / npm run stylelint / composer run cs:check)
  • Sign-off message is added to all commits
  • Tests (unit, integration and/or end-to-end) passing and the changes are covered with tests: PHPUnit for access, listing and the endpoint's answer; Vitest for the pair compared, the picker's choices and names, fetching (also waiting for a fetch already on its way), stale answers, the order after a restore, the document's folder and the keyboard handover; Playwright version-picker.spec.ts in Files (including a slow load) and a narrow window
  • Documentation (README or documentation) has been updated or is not required

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI tools
  • The AI-generated content was reviewed, comprehended and tested by a human

@hweihwang
hweihwang added this pull request to stack #9536 November 4, 2026 09:06
Each document title side by side, and the "From … to …" line above the
list of changes, is now a version picker. It lists the current file and
the retained versions, newest first, with author and label. Choices that
would put the newer version first are disabled; the current file counts
as the newest, also after a restore set its time back. Choosing one keeps
the view and the other end, tells screen readers which versions are now
compared, and gives the keyboard back to the picker. Links and images
resolve from the file's folder, also with an old version as the newer
end, and a comparison of two old versions does not wait for an editor
saving the current file.

The versions come from a new OCS endpoint, GET /apps/text/versions/{id}.
It answers only for a readable Markdown file in the user's own files that
is not end-to-end encrypted, and lists what the Versions tab shows. When a
version cannot be loaded, or the closing editor could not save, the
comparison says which and offers the pickers and Try again.
Public share pages get no picker.

Part of #8904

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Hoang Pham <hoangmaths96@gmail.com>
@hweihwang
hweihwang force-pushed the feat/comparison-version-picker branch from 9fd9f13 to 1f7f0be Compare November 9, 2026 11:36
@nextcloud-command nextcloud-command added the AI assisted This PR contains AI-assisted commits label Nov 9, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI assisted This PR contains AI-assisted commits

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants