-
Notifications
You must be signed in to change notification settings - Fork 58
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
Adds ignored files as a configurable feature #3434
base: main
Are you sure you want to change the base?
Conversation
/.*\/@eaDir\/.*/, # Synology temp files | ||
/__MACOSX/ # MACOS resource forks | ||
] | ||
@@patterns ||= model_ignored_files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be a class variable anymore now that we've got :model_ignored_files
?
@@ -0,0 +1,9 @@ | |||
class AddIgnoredFilesToSiteSettings < ActiveRecord::Migration[7.2] | |||
def change | |||
add_column :site_settings, :ignored_files, :text, null: true, default: [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need help figuring out the best way to do this migration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think SiteSettings is a flexible k/v store so you don't actually need to add the migration. But I'll check when I take a proper look at this probably tomorrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/huacnlee/rails-settings-cached is the gem that it's using, in case those docs help.
This looks great, thanks! Will it ignore directories too? |
As far as I know, it will ignore directories. The code is basically what you had previously but shifted around so it can be updated and stored in the DB. I probably need to update the specs to make sure they're testing both files and directories. |
Hah, OK, I'd completely forgotten that there are some files that are ignored already. I'll have a proper look at this tomorrow when I'm not juggling children... |
Checklist
🚨 Please review the guidelines for contributing to this repository. 🚨
Warnings
Summary
This will add a site setting to configure ignored files. The setting is configured using regex values in the UI, separated by new lines.
Linked issues
resolves #497
Description of changes
This adds a configurable filter in the site settings UI.
The text may need tweaking before merging as it's a little redundant. Please change as needed.
I made the section "File settings" as I think there are other things that could be added in the future, like "display preview thumbnail instead of rendering file" or something like that. I made it pretty generic.