Use cotton attachment card everywhere an attachment is shown#4892
Merged
Conversation
wes-otf
commented
Jun 23, 2026
| def size(self): | ||
| if not self.exists: | ||
| # Prevent an error for when a file doesn't exist | ||
| return 0 |
Contributor
Author
There was a problem hiding this comment.
Having this return 0 allows for editing of things like reports when the attachment has been deleted instead of it erroring out because it can't find the file
frjo
requested changes
Jun 24, 2026
frjo
left a comment
Member
There was a problem hiding this comment.
Two minor things to look at, otherwise a solid improvement.
Contributor
Author
|
Both should be resolved! Thanks for the flags @frjo! |
frjo
approved these changes
Jun 24, 2026
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.
Closes #4891. I found myself duplicating the logic that was in
templates/stream_forms/includes/file_field.htmlinto the cotton templates. With the push we've made to cotton lately, it felt more logical to wrap that logic all into one component and have a uniform display for attachments throughout Hypha.This also handles for missing attachments in comments & invoices as well as the existing submission & reports.
Test Steps