[Bugfix:Forum] Fix category release dates#12458
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #12458 +/- ##
=========================================
Coverage 21.67% 21.67%
Complexity 9802 9802
=========================================
Files 268 268
Lines 36724 36724
Branches 490 490
=========================================
Hits 7960 7960
Misses 28278 28278
Partials 486 486
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
Could a maintainer please approve the workflow runs? I've pushed fixes for the CI failures:
Thanks! |
There was a problem hiding this comment.
Pull request overview
Fixes a forum category “release date” crash by hardening backend date parsing and updating the categories UI to use a flatpickr-backed date picker, with new Cypress regression coverage.
Changes:
- Add
try/catchhandling inForumController::editCategory()to avoidInvalidArgumentExceptioncrashes on invalid dates. - Update the category date edit UI to use a flatpickr-enhanced input.
- Add Cypress E2E tests covering category release date add/edit/clear flows (and bump Cypress in npm deps).
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
site/app/controllers/forum/ForumController.php |
Catches invalid date parsing during category edits and returns a JSON failure instead of crashing. |
site/app/templates/forum/ShowCategories.twig |
Switches category date editing to a flatpickr-driven input and initializes flatpickr during edit interactions. |
site/cypress/e2e/Cypress-Feature/forums.spec.js |
Adds regression tests for category release date creation/editing/clearing behavior. |
site/package.json |
Bumps Cypress version. |
site/package-lock.json |
Lockfile updates corresponding to the Cypress bump. |
Files not reviewed (1)
- site/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
a3cb115 to
34f710e
Compare
|
@JManion32 Your requested changes have been addressed. Would appreciate another review from you whenever you are free. |
JManion32
left a comment
There was a problem hiding this comment.
Please ensure package-lock.json has no changes. Please also update your pull request description to include images of your updates to the UI, and remove mentions of bumping Cypress / changing package.json and package-lock.json. Thank you!
5811e11 to
57c562a
Compare
|
@JManion32 I have completely fixed this PR. I realized that previous file changes were completely unnecessary. Furthermore I have added detailed procedures on how to verify my fixes, along that I have also added screen recording. Please have a look when you have time. |
…ase date (Issue Submitty#12327) - Add validation for empty date strings in addNewCategory() and editCategory() - Treat empty/whitespace-only dates as null (no release restriction) - Wrap parseDateTime() calls in try-catch blocks to handle invalid formats - Return user-friendly error messages instead of crashing - Fix markPostUnread() to validate timestamp input - Fix editThread() to handle empty/invalid lock dates and expiration dates This prevents InvalidArgumentException when instructors leave release date fields empty or enter invalid date formats.
57c562a to
35ad3a2
Compare
JManion32
left a comment
There was a problem hiding this comment.
@GarvitKhandelwal31 were you able to reproduce the issue and get the error seen in #12327? Based on your instructions, it is unclear to me. Everything I have tried to reproduce on the error on main has worked as expected with no crashes. Please include instructions on exactly how to reproduce so I can verify that your changes are actually solving this issue. Thank you!
|
@IDzyre Would be grateful for your review in this. I saw that there are more open PRs on this issue, so here my review on them- Comparative Review: #12458 vs #12675 vs #12328This comment focuses on shortcomings in #12675 and #12328, and how #12458 addresses them. Shortcomings in #12675
Shortcomings in #12328
How #12458 fixes these
|
I am flying back from a vacation today. I will see if I can look into it tomorrow, but no promises. |
| // Navigate to the category management page. | ||
| cy.get('[data-testid="more-dropdown"]').click(); | ||
| cy.get('[data-testid="edit-categories-link"]').click(); | ||
| cy.get('#manage-categories-view').should('be.visible'); |
IDzyre
left a comment
There was a problem hiding this comment.
See comment about testid, and ensure this passes the tests in CI.
|
The 4 failures in late_submission_warning_messages.spec.js and gradeable_upload.spec.js are pre-existing flaky tests unrelated to this PR: late_submission_warning_messages failures 2 & 4: day count is off-by-one when CI runs before noon (server timezone boundary issue in getDueDateString()) If you would want I could open a separate PR and issue addressing them. |
Done, please refer the updated description for the review. |
dandrecollins07-ctrl
left a comment
There was a problem hiding this comment.
Passes manual test cases.
Minor note: Invalid dates such as 2026-99-99 automatically roll over to 2034-06-07.
Approved.
Why is this Change Important & Necessary?
Fixes #12327. Previously, when users submitted invalid dates while editing forum categories, the
ForumControllercrashed with anInvalidArgumentException.What is the New Behavior?
Forum category release dates now use a flatpickr date picker on both add and edit, with calendar opening on edit for easier selection.
What steps should a reviewer take to reproduce or test the bug or new feature?
A) Reproduce the original crash (vulnerable code)
B) Verify this PR fixes the issue
Automated Testing & Documentation
Other information