From 9427dc462e68eb4b902cd5b2ace5607b036504ef Mon Sep 17 00:00:00 2001 From: erdgeist Date: Wed, 8 Jul 2026 22:51:17 +0200 Subject: Fix revert being unusable from an unlocked nodes#show revert! requires the lock to already be held, correct for nodes#edit where the editor holds it throughout -- but both exclusive-case buttons on nodes#show fire from a node that starts out unlocked, which raised LockedByAnotherUser incorrectly. lock_for_editing! first makes both call sites safe: a harmless re-stamp when already the owner, a real but momentary acquisition otherwise, released again by revert! itself once nothing is left to protect. --- app/controllers/nodes_controller.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'app') diff --git a/app/controllers/nodes_controller.rb b/app/controllers/nodes_controller.rb index b56d779..d8586e2 100644 --- a/app/controllers/nodes_controller.rb +++ b/app/controllers/nodes_controller.rb @@ -112,6 +112,7 @@ class NodesController < ApplicationController end def revert + @node.lock_for_editing!(current_user) @node.revert!(current_user) if @node.draft redirect_to edit_node_path(@node) -- cgit v1.3