From ea8ee1d35948c6adc4a377c9eb77d99b2d856932 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Mon, 13 Jul 2026 14:12:33 +0200 Subject: Carry over other-locale translations when creating an autosave Node#autosave! only copied assets forward onto a newly created autosave, not translations. Invisible for single-locale nodes, but a node with an existing multi-locale head/draft that gets locked and edited in one locale would silently drop every other locale's translation from the new autosave -- and from there into the draft and eventually head, since save_draft! faithfully clones whatever the autosave actually holds. Fixed by using clone_attributes_from, which already does a complete clone (translations, assets, tags, template, published_at) -- the same method save_draft! already relies on two branches later, so no new mechanism, just closing the one place still doing a partial, hand-rolled version of it. --- app/models/node.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/models/node.rb') diff --git a/app/models/node.rb b/app/models/node.rb index 6f435ee..535d8f1 100644 --- a/app/models/node.rb +++ b/app/models/node.rb @@ -80,7 +80,7 @@ class Node < ApplicationRecord unless self.autosave self.autosave = Page.create!(:editor => current_user) - self.autosave.assets = (self.draft || self.head).assets if self.draft || self.head + self.autosave.clone_attributes_from(self.draft || self.head) if self.draft || self.head self.save! end self.autosave.assign_attributes(attributes) -- cgit v1.3