feat(content-uploader): implement warning modal for upload items exceeding size limit#4649
feat(content-uploader): implement warning modal for upload items exceeding size limit#4649olehrybak wants to merge 7 commits into
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Walkthrough
ChangesLarge File Warning Modal Feature
Sequence Diagram(s)sequenceDiagram
participant ContentUploader
participant upload
participant LargeFileWarningModal
ContentUploader->>upload: upload() called
upload->>upload: check pending files against maxFileSize
alt oversized pending files exist
upload->>LargeFileWarningModal: open modal
else all pending files fit
upload->>upload: start upload
end
LargeFileWarningModal-->>ContentUploader: onConfirm
ContentUploader->>ContentUploader: remove oversized pending files
ContentUploader->>upload: start remaining upload
LargeFileWarningModal-->>ContentUploader: onCancel
ContentUploader->>ContentUploader: remove all pending files and close modal
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/elements/content-uploader/ContentUploader.tsx`:
- Around line 1737-1759: The modernized uploads flow is mounting
LargeFileWarningModal even when ContentUploaderProps.maxFileSize is undefined,
but the modal expects a valid number and formats it immediately. Update
ContentUploader.render and the LargeFileWarningModal usage to guard on
maxFileSize being defined before rendering, or make the modal handle an optional
limit internally; use the ContentUploader and LargeFileWarningModal symbols to
locate the affected path.
- Around line 1673-1694: The batch modal handlers in ContentUploader.tsx are
removing items one-by-one through removeFileFromUploadQueue, which can
auto-start uploads before the full batch is pruned. Update
handleLargeFileWarningUploadRest and handleLargeFileWarningCancel to remove the
affected pending/oversize items in a single batch update instead of looping
through the helper, then trigger upload only after the queue mutation is
complete in handleLargeFileWarningUploadRest. Keep the logic localized to these
methods and the queue-management flow around getOversizePendingItems,
removeFileFromUploadQueue, and upload.
- Line 241: The large-file warning gate is still bypassed because some
enqueue/start paths call this.upload directly instead of going through the
shared gated flow. Update ContentUploader so the gating logic lives on the
common “start pending uploads” path used by addFilesToUploadQueue, maybeUpload,
and the success/error/remove callbacks, and ensure any prepopulated file
handling also respects the gate. Replace the remaining direct upload triggers
with the shared pending-upload starter so batch B cannot begin automatically
after the modal is shown.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: b79a44a4-4af4-4034-8860-fd2fdf7aa52a
⛔ Files ignored due to path filters (1)
i18n/en-US.propertiesis excluded by!i18n/**
📒 Files selected for processing (6)
src/elements/content-uploader/ContentUploader.tsxsrc/elements/content-uploader/LargeFileWarningModal.scsssrc/elements/content-uploader/LargeFileWarningModal.tsxsrc/elements/content-uploader/__tests__/ContentUploader.test.jssrc/elements/content-uploader/__tests__/LargeFileWarningModal.test.tsxsrc/elements/content-uploader/messages.ts
Summary
Added a warning modal that is shown for upload batches that include items that exceed the max size limit (based on the new
maxFileSizeprop). In case if the modal is shown, uploading is not started for the new files until a user completes the modal actionSummary by CodeRabbit
maxFileSizesupport to the content uploader.