summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-07-08 22:51:17 +0200
committererdgeist <erdgeist@erdgeist.org>2026-07-08 22:51:17 +0200
commit9427dc462e68eb4b902cd5b2ace5607b036504ef (patch)
tree17b16025f41d482087da02b06f7453d71f1298cc /app/controllers
parent0bc112baec8b3d19aba3c1757cb4cf81fda098c5 (diff)
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.
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/nodes_controller.rb1
1 files changed, 1 insertions, 0 deletions
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
112 end 112 end
113 113
114 def revert 114 def revert
115 @node.lock_for_editing!(current_user)
115 @node.revert!(current_user) 116 @node.revert!(current_user)
116 if @node.draft 117 if @node.draft
117 redirect_to edit_node_path(@node) 118 redirect_to edit_node_path(@node)