Timer safety: length limit, server-side saving, stop on close

- Maximum timer length setting (default 10h): a timer that runs past it
  is stopped at the limit and its entry's comment is flagged, so a
  forgotten timer can't add a night or weekend of hours
- StopwatchTimerTickJob saves a running timer's time every minute on the
  server (no browser needed) and stops it at the limit on time; open
  tabs keep saving too
- Timer updates lock the user's preference row and re-read the timer, so
  simultaneous saves (several tabs, the job) never add time twice
- Closing an issue stops timers running on it before anything else (e.g.
  billing) uses its time; deleting a time entry only stops the timer
  running on that entry
- Issue timers require a visible issue; starting again moves the timer
  instead of raising "timer is already running"
- Tests updated and extended (limit, locking, tick job, close, delete,
  visibility, issue context menu); CI runs on Redmine 7.0
- Upstream's German notes translated

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
This commit is contained in:
Claude committed 2026-10-29 00:13:21 -04:00
1 parent c3d6948735
commit 626db60658
15 files changed
+366 -36

No files matched your search

+6
View File
@@ -3,6 +3,12 @@
<%= select_tag 'settings[default_activity]', options_from_collection_for_select( [['always_ask', t('.label_always_ask')], ['system', t('.label_system')]] + TimeEntryActivity.system.active.to_a.pluck(:id, :name), :first, :last, Stopwatch.settings['default_activity'] ) %>
</p>
<p>
<label for="settings_max_timer_hours"><%= t '.label_max_timer_hours' %></label>
<%= text_field_tag 'settings[max_timer_hours]', Stopwatch.settings['max_timer_hours'] || '10', size: 4, id: 'settings_max_timer_hours' %>
<em class="info"><%= t '.text_max_timer_hours' %></em>
</p>
<p>
<label for="settings_highlighted_links"><%= t '.label_highlighted_links' %> </label>
<%= hidden_field_tag 'settings[highlighted_links]', '0', id: nil %>