Defect #44218
openLog time block disappears on validation error when closing issue with "Accept time logs on closed issues" disabled
Description
- Steps to reproduce
1. Have "Accept time logs on closed issues" disabled (Administration > Settings > Time tracking)
2. Open an issue with an open status
3. Change status to a closed status
4. Fill in "Hours" in the Log time block but leave "Activity" blank
5. Click Save
- Expected behavior
The Log time block remains visible so the user can correct the validation error.
- Actual behavior
The Log time block disappears after the validation error is shown, making it impossible
to correct the time entry without reloading the page.
- Root cause
`time_loggable?` checks `closed?` which reflects the in-memory state after the failed save.
The issue object already has the closed status assigned even though the save was rolled back.
- Proposed fix
In `app/views/issues/_edit.html.erb`, line 12:
Change:
<% if @issue.time_loggable? %>
To:
<% if @issue.time_loggable? || (!@issue.was_closed? && @issue.errors.any?) %>
This uses the existing `was_closed?` method (which checks `status_was`) to detect the
original status before the failed save attempt.
Files
No data to display