Running timers page with view/stop permissions

- New top-menu page listing running timers: owner, issue, project,
  activity, start time, time on this run and entry total, oldest first;
  refreshes every minute
- Role permissions "View running timers" and "Stop other users' timers",
  checked against each timer's project; users can always stop their own
- A timer can be stopped at an earlier time (when the person left):
  hours logged after it are taken off the entry, and the comment notes
  who stopped it and when
- Timers now record when they were started (session_started_at); timers
  running from before show "unknown" until restarted
- Integration tests for permissions, project scoping and stopping; unit
  tests for Timer#stop_for

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 07:06:08 -04:00
1 parent 626db60658
commit 78f53d5d5a
11 files changed
+399 -1

No files matched your search

+19
View File
@@ -1,6 +1,25 @@
en:
label_stopwatch_start: Start tracking
label_stopwatch_stop: Stop tracking
label_stopwatch_running_timers: Running timers
label_stopwatch_no_running_timers: No timers are running.
label_stopwatch_refresh: Refresh
label_stopwatch_started_at: Started
label_stopwatch_running_for: Running for
label_stopwatch_entry_total: Entry total
label_stopwatch_stop_timer: Stop
label_stopwatch_stopped_at: Stopped at
label_stopwatch_unknown_start: unknown
text_stopwatch_unknown_start: "Started before start times were recorded; it will show once the timer is restarted"
text_stopwatch_stopped_at: "Optional: when they actually stopped working. Hours logged after this time are taken off the entry. Leave blank to stop now."
text_stopwatch_confirm_stop: "Stop %{name}'s timer?"
text_stopwatch_running_timers_help: "Oldest first. To stop a forgotten timer at the time the person left, fill in \"Stopped at\" before pressing Stop; otherwise it stops now."
text_stopwatch_timer_stopped_by: "[Timer stopped by %{name}, at %{time}]"
notice_stopwatch_timer_stopped_for: "Stopped %{name}'s timer (%{hours} on this run)."
notice_stopwatch_timer_not_running: "%{name}'s timer was no longer running."
error_stopwatch_invalid_stop_time: "That stop time couldn't be read. Please pick a date and time."
permission_view_running_timers: View running timers
permission_stop_running_timers: Stop other users' timers
text_stopwatch_timer_capped: "[Timer stopped automatically at the %{hours} hour limit - please check these hours]"
stopwatch:
settings:
+3
View File
@@ -9,6 +9,9 @@ resources :stopwatch_timers, only: %i(new create edit update) do
end
end
get 'stopwatch/running_timers', to: 'stopwatch_running_timers#index', as: :stopwatch_running_timers
post 'stopwatch/running_timers/:user_id/stop', to: 'stopwatch_running_timers#stop', as: :stop_stopwatch_running_timer
scope 'issues/:issue_id' do
post 'timer/start', to: 'stopwatch_issue_timers#start', as: :start_issue_timer
post 'timer/stop', to: 'stopwatch_issue_timers#stop', as: :stop_issue_timer