test(theming): cover background file picker mime filtering - #62221
test(theming): cover background file picker mime filtering#62221mvanhorn wants to merge 1 commit into
Conversation
|
Done in 3b6c67f — added |
|
Thank you :) Please rebase onto current master branch. Also you need to signoff both commits (to pass the DCO check). |
The empty-dialog fix landed on master via the setMimeTypeFilter change; this adds the missing regression coverage: the picker is built with an image mime filter and folders stay navigable. Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
3b6c67f to
eb34d29
Compare
|
Rebased onto current master with signoff. While rebasing I found the picker fix itself already landed via the setMimeTypeFilter change, so I slimmed this down to what master is still missing: regression coverage for the picker (image mime filter applied, folders navigable). Can retitle if you'd like. |
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
Summary
This is a regression introduced by commit 15c336f (2026-07-01, "adjust file picker for background image to allow folder navigation"), which replaced the working image filter
.setFilter((node) => node.mime.startsWith('image/'))with.setMimeTypeFilter(['image/*'])in thepickFile()function. The intent of that change was correct (a baresetFilterpredicate hides folders too, so users could not navigate into subfolders), but the['image/*']mimetype-filter path yields an empty browse list in practice, while the other image picker in the codebase (apps/settings/src/components/PersonalInfo/AvatarSection.vue) uses explicit types['image/png', 'image/jpeg']rather than the glob. FixpickFile()by restoring a working image filter that also keeps directories visible for navigation: replace.setMimeTypeFilter(['image/*'])with a folder-aware predicate.setFilter((node) => node.type === 'folder' || node.mime?.startsWith('image/'))(this mirrors the FilePicker's own internal rule of always showing folders plus matching files, and restores the pre-regression image display without reintroducing the folder-navigation problem). This is the delta versus the 2026-07-01 change: it keeps folder navigation but stops the browse list from coming back empty. The fix is self-contained inUserSectionBackground.vue; its only consumer,apps/theming/src/views/UserTheming.vue, needs no change. Add a focused unit test that mocks@nextcloud/dialogs(to capture the filter callback passed to the builder) and@nextcloud/initial-state(the component reads severalloadStatevalues at module load), then asserts the predicate accepts a folder node and animage/pngnode and rejects atext/plainnode.Checklist
AI (if applicable)