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

+10
View File
@@ -12,6 +12,16 @@ Redmine::Plugin.register :stopwatch do
'max_timer_hours' => '10',
}, partial: 'stopwatch/settings'
# Running timers page: see everyone's running timers, and stop one someone forgot. Both are role
# permissions, so they apply to timers on time entries in the projects where the role has them.
permission :view_running_timers, { stopwatch_running_timers: [:index] }
permission :stop_running_timers, { stopwatch_running_timers: [:stop] }
menu :top_menu, :stopwatch_running_timers,
{ controller: 'stopwatch_running_timers', action: 'index' },
caption: :label_stopwatch_running_timers,
if: ->(*_){ User.current.allowed_to?(:view_running_timers, nil, global: true) }
menu :account_menu, :stopwatch,
:new_stopwatch_timer_path,
caption: :button_log_time,