feat: add draft-state banner and Save as Incomplete flow for NonReceived submissions#968
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughAdds “save as incomplete” draft support: a Redux thunk to persist drafts, EventForm helpers and UI to detect and save incomplete events, i18n strings, and EditSummitEventPage wiring to pass the draft-save handler into the form. ChangesDraft Event Saving Feature
Sequence DiagramsequenceDiagram
participant User
participant EventForm
participant handleSaveIncomplete
participant saveEventAsDraft
participant API
User->>EventForm: View incomplete event form
EventForm->>EventForm: getMissingDraftFields()
EventForm->>EventForm: Render draft warning banner
User->>EventForm: Click "Save as Incomplete"
EventForm->>handleSaveIncomplete: handleSaveIncomplete(event)
handleSaveIncomplete->>saveEventAsDraft: onSaveIncomplete(entity)
saveEventAsDraft->>API: PUT /events/{id}/draft
API-->>saveEventAsDraft: 200 OK
saveEventAsDraft->>User: Show success message + reload
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested Reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsStopped waiting for pipeline failures after 30000ms. One of your pipelines takes longer than our 30000ms fetch window to run, so review may not consider pipeline-failure results for inline comments if any failures occurred after the fetch window. Increase the timeout if you want to wait longer or run a 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/actions/event-actions.js`:
- Around line 911-948: saveEventAsDraft calls the PUT draft endpoint using
entity.id without checking it; add an early guard in saveEventAsDraft to verify
entity.id is present and valid before building the URL and calling putRequest
(the function name is saveEventAsDraft and the URL uses currentSummit.id and
entity.id). If entity.id is missing, dispatch stopLoading or showMessage with a
clear error (reusing showMessage and T.translate keys), and return a rejected
Promise (or simply return) to avoid calling
putRequest/createAction(UPDATE_EVENT)/createAction(EVENT_UPDATED); only proceed
to normalizeEvent and call putRequest when entity.id exists.
In `@src/components/forms/event-form.js`:
- Around line 737-740: The isComplete() method assumes this.state.entity and its
fields exist; make the logic explicitly check for entity and defined
status/progress before comparing. Update isComplete to first guard that
this.state.entity is truthy and that entity.status and entity.progress are not
undefined (or use explicit comparisons like entity.status === "Received" &&
entity.progress === "COMPLETE" only after those checks) so the method clearly
documents intent and avoids issues if the entity shape changes.
- Around line 742-761: getMissingDraftFields currently uses inverted checks
("!entity.type_id || ...") which causes date and disclaimer validations to run
when no type is selected; change both conditionals to require a type and the
field applicability (use "entity.type_id &&
this.shouldShowField('allows_publishing_dates')" for the dates block and
"entity.type_id && this.isEventType(EVENT_TYPE_PRESENTATION)" for the disclaimer
block) so the method only validates those fields when a type is set and the UI
would show them.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: a0301408-1a1b-4ada-8c20-1c0317b20913
📒 Files selected for processing (4)
src/actions/event-actions.jssrc/components/forms/event-form.jssrc/i18n/en.jsonsrc/pages/events/edit-summit-event-page.js
4162b15 to
6a2d596
Compare
ref https://app.clickup.com/t/86ba3xg57
Summary by CodeRabbit
New Features
Documentation