Fix form submission staying in draft status #13

Merged
timmybee merged 1 commits from fix/submit-draft-status into master 2026-03-06 12:29:00 +08:00
Owner

Summary

  • ApprovalService::submit() was silently returning when no active workflow existed, leaving requests in Draft while falsely showing a success message
  • Added a guard in the Livewire component to check for an active workflow before creating any records, showing a clear error to the user if none is configured
  • ApprovalService::submit() now throws a RuntimeException instead of silently returning, so failures are never swallowed
  • Fixed draft save flash message — it was always firing even when validation failed

Test plan

  • Submit a travel request with an active workflow → status becomes Pending, appears in dashboard with Review button
  • Submit a travel request with no active workflow → error shown, no record created
  • Save draft → status stays Draft, no approvals created
  • Run php artisan test --compact tests/Feature/TravelRequestSubmissionTest.php — all 4 tests pass
## Summary - `ApprovalService::submit()` was silently returning when no active workflow existed, leaving requests in `Draft` while falsely showing a success message - Added a guard in the Livewire component to check for an active workflow before creating any records, showing a clear error to the user if none is configured - `ApprovalService::submit()` now throws a `RuntimeException` instead of silently returning, so failures are never swallowed - Fixed draft save flash message — it was always firing even when validation failed ## Test plan - [ ] Submit a travel request with an active workflow → status becomes Pending, appears in dashboard with Review button - [ ] Submit a travel request with no active workflow → error shown, no record created - [ ] Save draft → status stays Draft, no approvals created - [ ] Run `php artisan test --compact tests/Feature/TravelRequestSubmissionTest.php` — all 4 tests pass
timmybee added 1 commit 2026-03-06 12:28:29 +08:00
Fix form submission staying in draft status
All checks were successful
linter / quality (pull_request) Successful in 1m34s
security / Dependency Audit (pull_request) Successful in 1m30s
security / Static Analysis (pull_request) Successful in 1m32s
tests / ci (8.4) (pull_request) Successful in 1m25s
tests / ci (8.5) (pull_request) Successful in 1m58s
e01caf678b
When no active approval workflow exists, ApprovalService::submit() was
silently returning, leaving the request in Draft while showing a false
success message. Now throws a RuntimeException as a safety net, and the
Livewire component guards before creating any records and shows a clear
error to the user.
timmybee merged commit 7b26fc57f4 into master 2026-03-06 12:29:00 +08:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: timmybee/travel#13