From 180b5feba092db1339f7bb3217e91f0b22239bc5 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Mon, 27 Jul 2026 02:53:21 +0200 Subject: Surface held locks in the dashboard's work-in-progress widget A lock with no draft or autosave behind it was invisible to everyone including its holder, until the next editor collided with it. work_in_progress now admits those nodes, and the widget names the holder rather than the last editor on any locked row. Also flips the ordering to stalest-first, so a backlog reads as a queue rather than a feed, and gives the heading a real total: the count came from the already-limited relation and could never exceed five. --- app/controllers/admin_controller.rb | 4 +++- app/controllers/nodes_controller.rb | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index d9cf1be6..2b35fd20 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -5,7 +5,9 @@ class AdminController < ApplicationController before_action :login_required def index - @drafts = Node.drafts_and_autosaves(current_user_id: current_user.id).limit(5) + scope = Node.work_in_progress(current_user_id: current_user.id) + @drafts_total = scope.reorder(nil).count + @drafts = scope.includes(:head, :draft, :lock_owner).limit(5) @actions = NodeAction.order(:occurred_at => :desc, :id => :desc).limit(5) end diff --git a/app/controllers/nodes_controller.rb b/app/controllers/nodes_controller.rb index 50b30881..2a2cde33 100644 --- a/app/controllers/nodes_controller.rb +++ b/app/controllers/nodes_controller.rb @@ -231,7 +231,7 @@ class NodesController < ApplicationController # Filter functions for admin views def drafts - @nodes = index_matching(Node.drafts_and_autosaves) + @nodes = index_matching(Node.work_in_progress) end def mine -- cgit v1.3