[WEB-2229] fix: issue attachments toast error#5424
Conversation
…/issue-attachments-toast-error
WalkthroughThe changes enhance the file upload functionality in the Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
Outside diff range, codebase verification and nitpick comments (2)
web/core/components/issues/issue-detail-widgets/attachments/quick-action-button.tsx (1)
38-79: LGTM! Consider simplifying the toast message condition.The logic correctly handles rejected files and displays appropriate toast notifications. However, you can simplify the toast message condition as follows:
- message: (totalAttachedFiles>1)? - "Only one file can be uploaded at a time." : - "File must be 5MB or less.", + message: totalAttachedFiles > 1 + ? "Only one file can be uploaded at a time." + : "File must be 5MB or less.",web/core/components/issues/attachment/attachment-item-list.tsx (1)
41-79: LGTM! Consider simplifying the toast message condition.The logic correctly handles rejected files and displays appropriate toast notifications. However, you can simplify the toast message condition as follows:
- message: (totalAttachedFiles>1)? - "Only one file can be uploaded at a time." : - "File must be 5MB or less.", + message: totalAttachedFiles > 1 + ? "Only one file can be uploaded at a time." + : "File must be 5MB or less.",
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- web/core/components/issues/attachment/attachment-item-list.tsx (2 hunks)
- web/core/components/issues/issue-detail-widgets/attachments/quick-action-button.tsx (3 hunks)
Additional comments not posted (8)
web/core/components/issues/issue-detail-widgets/attachments/quick-action-button.tsx (4)
4-4: LGTM!The import statement for
FileRejectionis correct and necessary for handling rejected files.
6-6: LGTM!The import statement for
TOAST_TYPEandsetToastis correct and necessary for displaying toast notifications.
37-37: LGTM!The
onDropfunction signature is correctly updated to accept therejectedFilesparameter.
84-84: LGTM!The
useDropzoneconfiguration is correctly updated to use theonDropfunction.web/core/components/issues/attachment/attachment-item-list.tsx (4)
3-3: LGTM!The import statement for
FileRejectionis correct and necessary for handling rejected files.
6-6: LGTM!The import statement for
TOAST_TYPEandsetToastis correct and necessary for displaying toast notifications.
40-40: LGTM!The
onDropfunction signature is correctly updated to accept therejectedFilesparameter.
Line range hint
84-84: LGTM!The
useDropzoneconfiguration is correctly updated to use theonDropfunction.
Changes:
This PR fixes the toast behaviour when an attachment to an issue is rejected.
Action Button and DragNDrop are implemented separately in the code, so they are addressed separately.
Reference
[WEB-2229]
Summary by CodeRabbit