-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
File Tree Diff: allow users to ignore files #11977
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
Conversation
Add a field to allow users to tell us what files should be ignored when comparing versions. This is going to be used by the front-end to don't expose these files in the list of added/modified/deleted files. Closes #11694
We don't expose it to all the users yet, but we want to expose it for those that we already enabled it on the Django Admin. Requires readthedocs/readthedocs.org#11977
Filter the added/modified list of files to filter our "ignored files" coming from the API response. Requires readthedocs/readthedocs.org#11977
I still need to write some tests for this. |
I updated this PR with all the feedback I received (strip lines and use |
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.
Would be good to get this in next deploy 👍
"filetreediff_enabled": _("Enabled"), | ||
"filetreediff_ignored_files": _("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.
All these labels should be in the model itself, not just in the form.
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.
What we would need to use there, verbose_name
?
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.
yeah
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 created an issue at #11986
readthedocs/projects/forms.py
Outdated
"""Convert a text area into a list of items (one per line).""" | ||
if not value: | ||
return [] | ||
return [line.strip() for line in value.splitlines()] |
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.
This should probably filter out empty lines. Maybe worth doing this at the model level.
We should also normalize patterns to how the filenames are matched (e.g, if they start or not with a /). I think we do something like this for search.
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.
This should probably filter out empty lines. Maybe worth doing this at the model level.
Done. I pushed a commit to ignore empty lines.
We should also normalize patterns to how the filenames are matched (e.g, if they start or not with a /). I think we do something like this for search.
I followed the pattern we already have on filetreediff. Currently, the matches start without a /
as shown in the UI (the backend saves the filenames in that way as well --we are showing it as it is in the db)
I like this approach because using starting files with /
could be confused with language and version, since people may think it's the full absolute path. For the example shown in the image, the user needs to write commercial/privacy-level.html
, or commercial/*
or similar ones.
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 meant that whatever we choose, we should normalize the paths to match that, e.g, if the user enters /path
as a pattern, we should convert that to path
, otherwise /path
won't match anything.
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 opened #11987 for that.
Discussion #11977 (comment) --------- Co-authored-by: Santos Gallegos <[email protected]>
Add a field to allow users to tell us what files should be ignored when comparing versions. This is going to be used by the front-end to don't expose these files in the list of added/modified/deleted files.
Peek.2025-02-05.14-26.webm
Closes #11694