fix: sort recent files newest first - #85
Merged
Merged
Conversation
sortNodes() from @nextcloud/files inverts the sorting order when
sortingMode is 'mtime' ('asc' means most recently modified first).
Passing 'desc' therefore showed the oldest documents at the top of
the Recent list — and since OfficeOverview caps the rendered list at
MAX_DISPLAY_FILES (200), users with more matching files than that saw
the 200 oldest, with the newest hidden behind "Show all in Files"
entirely. Pass 'asc' and document the inversion.
Adds a regression test pinning that the cap keeps the newest files,
not the oldest, plus updates the existing sort-order spec.
Diagnosis and original fix by Frank Karlitschek (#79); rebased here
onto current main (the file-filtering logic has since moved to
src/utils/fileFilters.ts) with the accompanying tests applied.
Co-authored-by: Frank Karlitschek <karlitschek@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
Contributor
Author
|
@karlitschek I did a new PR here from the newer main - has tests extracted |
1 task
emberfiend
approved these changes
Jul 23, 2026
Contributor
Author
|
/compile |
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
moodyjmz
added a commit
that referenced
this pull request
Aug 10, 2026
The two existing testing rules cover a new unit and a changed signature, but not the most common shape a bug fix takes: same signature, corrected behavior. That gap is exactly what PR #85's own regression test closed (newest-first cap) and what the DAV orderby/limit fix in #100 needed independent of its return-shape change — the doc's rules shouldn't cover the shapes that made this branch's own examples but miss the shape most bug fixes actually are. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
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
Replaces #79, rebased onto current
mainand with tests applied — the file-filtering logic #79 targeted has since moved fromOfficeOverview.vuetosrc/utils/fileFilters.ts(refactor: extract file-filtering logic to utils), so #79 as written no longer touches the live code path.sortNodes()from@nextcloud/filesinvertssortingOrderforsortingMode: 'mtime'('asc'= newest first).mainpassed'desc', so the Recent list rendered oldest-first.OfficeOverview.vuecaps the rendered list atMAX_DISPLAY_FILES(200) after sorting. Anyone with more than 200 matching files was seeing the 200 oldest, with the actual newest files hidden entirely behind "Show all in Files".src/utils/fileFilters.ts, updates the existing sort-order spec, and adds a regression test pinning that the 200-file cap keeps the newest files, not the oldest (previously untested — a revert to'desc'would have passed CI green).Diagnosis and the original one-line fix are Frank Karlitschek's (#79) — credited via
Co-authored-by:on the commit. This PR is that fix carried forward onto currentmainwith the target file corrected and tests added.Test plan
npm run test:unit— 70/70 passing (Node 24; Node 25 has an unrelated knownlocalStorage/jsdom issue, see README)OfficeOverview > MAX_DISPLAY_FILES cap > keeps the newest files, not the oldest