Project

General

Profile

Actions

Defect #44218

open

Log time block disappears on validation error when closing issue with "Accept time logs on closed issues" disabled

Added by Mateus Anacleto 1 day ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Time tracking
Target version:
-
Resolution:
Affected version:

Description

  1. 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

  1. Expected behavior

The Log time block remains visible so the user can correct the validation error.

  1. 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.

  1. 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.

  1. Proposed fix

In `app/views/issues/_edit.html.erb`, line 12:

Change:
<% if @issue.time_loggable? %>

To:
<% if @issue.time_loggable? || (_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

fix_time_log_block.patch (469 Bytes) fix_time_log_block.patch Mateus Anacleto, 2026-06-26 14:31

No data to display

Actions

Also available in: Atom PDF