Skip to content

feat: setting to show/hide hidden files #1541

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jrvidal
Copy link

@jrvidal jrvidal commented May 9, 2025

This is a fix for #1245. It adds a new showHidden setting to control whether hidden files/folders are displayed to the user or not.

  • "Hidden" means "starts with a dot", a la UNIX. I'm not sure how much we care about a hypothetical notes folder living within a Windows FS that contains windows-like hidden files. (I supposed the answer is "not much").

  • The setting is only respected in the main web interface, and ignored for API methods. This is a quick-n-dirty compromise between letting clients handle hidden folders/files as they see fit on their own; vs. exposing this setting as public and store it per client (which goes beyond my knowledge of NC internals).

  • The setting also affects other entrypoints that transitively depend on NotesService#getAll(), such as the search provider and the top-level notes. This seems appropriate to me, given its main usecase is probably metadata files generated by 3rd party apps.

  • I've set the default to true so it is "backwards compatible". I'm not sure how acceptable would be to switch it to false.

  • I haven't been able to get a proper setup to run tests locally, but I do want to add some tests.

fixes nextcloud#1245

Signed-off-by: Roberto Vidal <roberto.vidal@ikumene.com>
Comment on lines +211 to +215
if (this.settingsOpen) {
this.$data.initialShowHidden = Boolean(store.state.app.settings.showHidden)
} else if (this.$data.initialShowHidden !== store.state.app.settings.showHidden) {
this.$emit('reload')
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm getting fancy here and trying to avoid full in-place reloads until they're absolutely needed, instead of using onChangeSettingsReload(). I'm not sure it's a good fit for NC's general UX approach.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good to me. 👍

@juliusknorr juliusknorr self-requested a review May 12, 2025 09:04
@juliusknorr juliusknorr added enhancement New feature or request 3. to review labels May 12, 2025
@juliusknorr
Copy link
Member

Thanks a lot for your PR. I've restarted tests and think there are some static analysis errors that need to be addressed, but the general PR seems almost ready to merge. A few small things commented inline and some feedback on your comments:

"Hidden" means "starts with a dot", a la UNIX. I'm not sure how much we care about a hypothetical notes folder living within a Windows FS that contains windows-like hidden files. (I supposed the answer is "not much").

It is fine to assume that but good that you raised it as a question. Our web frontend and file system layers only handle files starting with a dot as hidden. I'm not sure how that propagates to the desktop client but we do not have any special logic for hidden files in other backend areas. For SMB as external storage we are able to detect the hidden flag but this would then already be filtered out in the storage layers (https://github.com/nextcloud/server/blob/e9e67cbc50d0b1efb02a734b4c858b32ef8832c0/apps/files_external/lib/Lib/Storage/SMB.php#L237)

The setting is only respected in the main web interface, and ignored for API methods. This is a quick-n-dirty compromise between letting clients handle hidden folders/files as they see fit on their own; vs. exposing this setting as public and store it per client (which goes beyond my knowledge of NC internals).

For the mobile apps we could extend the API within notes to also pass the value along in

$showHidden = true;
As long as the mobile apps for notes are using the dedicated endpoints and not WebDAV I'd say they can also respect the setting.

The setting also affects other entrypoints that transitively depend on NotesService#getAll(), such as the search provider and the top-level notes. This seems appropriate to me, given its main usecase is probably metadata files generated by 3rd party apps.

Would agree with that as well.

I've set the default to true so it is "backwards compatible". I'm not sure how acceptable would be to switch it to false.

I'd be fine to even switch the default, but not sure what @marcoambrosini would think about this as designer? Also @enjeck @juliusknorr as primary maintainers of the app?

I haven't been able to get a proper setup to run tests locally, but I do want to add some tests.

I remember that was a bit more tricky, they also are not that standard compared to other Nextcloud apps. Something we could follow up later on.

Comment on lines +211 to +215
if (this.settingsOpen) {
this.$data.initialShowHidden = Boolean(store.state.app.settings.showHidden)
} else if (this.$data.initialShowHidden !== store.state.app.settings.showHidden) {
this.$emit('reload')
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good to me. 👍

Copy link
Contributor

@enjeck enjeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just nitpicks that you can ignore

@jrvidal jrvidal force-pushed the show-hidden-setting branch from f5adc21 to 1931164 Compare May 14, 2025 08:37
@jrvidal
Copy link
Author

jrvidal commented May 14, 2025

@juliusknorr

For the mobile apps we could extend the API within notes to also pass the value along in

$showHidden = true;

As long as the mobile apps for notes are using the dedicated endpoints and not WebDAV I'd say they can also respect the setting.

Sorry I'm a bit confused by this comment. Are you saying we should not hardcode $showHidden = true for the API endpoints, and read from settings instead? What do you mean by the "API within notes"?

Re: mobile apps using WebDAV: I assume you mean that we have no control over apps that use WebDAV, correct? i.e. that there's no way to propagate this setting for them (I assume the WebDAV handling is part of files itself).

@juliusknorr
Copy link
Member

Sorry I'm a bit confused by this comment. Are you saying we should not hardcode $showHidden = true for the API endpoints, and read from settings instead? What do you mean by the "API within notes"?

Yes, sorry if that was not clear enough. I'd read the setting there instead of the hardcoded one as well.

Re: mobile apps using WebDAV: I assume you mean that we have no control over apps that use WebDAV, correct? i.e. that there's no way to propagate this setting for them (I assume the WebDAV handling is part of files itself).

Yes, that is in the responsibility of webdav / Nextcloud server then to handle.

jrvidal added 2 commits May 14, 2025 15:00
Signed-off-by: Roberto Vidal <roberto.vidal@ikumene.com>
Signed-off-by: Roberto Vidal <roberto.vidal@ikumene.com>
@jrvidal jrvidal force-pushed the show-hidden-setting branch from 1931164 to 27ddb2c Compare May 14, 2025 13:01
@marcoambrosini
Copy link
Member

I'd be fine to even switch the default, but not sure what @marcoambrosini would think about this as designer?

I'd agree with defaulting with not showing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants