summaryrefslogtreecommitdiff
path: root/app/controllers/admin_controller.rb
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-07-13 19:10:55 +0200
committererdgeist <erdgeist@erdgeist.org>2026-07-13 19:10:55 +0200
commit4072efdc912ecb3b79621fb1838434f792e3a531 (patch)
treeaf2cafbec6068a6ee05ac70a064e2ffb2bf369fe /app/controllers/admin_controller.rb
parent1234371b084356c7542e53d20c9b816332a945d3 (diff)
clone_attributes_from: update translations in place, not delete+recreate
Every promotion (autosave creation, draft creation, draft save) ran every locale's translation through delete-all-then-recreate unconditionally, giving every locale a fresh created_at/updated_at regardless of whether its content actually changed. Confirmed via Node.find(546).draft.translations -- both DE and EN shared one identical timestamp despite only EN having been edited. This silently defeated Page.find_with_outdated_translations' whole staleness comparison: every save reset every locale back into lockstep, so timestamps could never actually drift apart the way the feature depends on. The existing test for it only ever passed by manually backdating a timestamp with record_timestamps = false, bypassing normal save flow entirely -- not something that happens through ordinary editing. Now updates a matching locale's translation only when its own attributes actually differ, creates one genuinely new, and removes one genuinely gone from the source -- same end state, but real per-locale timestamps survive an unrelated save. search_vector is excluded from both the comparison and the copied attributes: it's DB-trigger-maintained from title/abstract, not real content, and comparing a precomputed tsvector risked a false 'changed' from representation noise alone. Also reloads the source's translations association, not just self's -- clone_attributes_from previously only guaranteed a fresh self, leaving any caller holding a page reference across an earlier mutation vulnerable to reading a stale cached association.
Diffstat (limited to 'app/controllers/admin_controller.rb')
0 files changed, 0 insertions, 0 deletions