Reopen published posts to draft only when published content actually changes #70
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Source: Audit section 2.1.
Spec:
specs/post.alliumrule ReopenPublishedPost requireschanges_affect_published_content(changes).bDS2:
../bDS2/lib/bds/posts.exmaybe_reopen_published_post+published_content_change?(~line 607): reopens only when one of title, excerpt, content, author, language, tags, categories, do_not_translate is present in the update AND differs from the current value. template_slug changes do NOT reopen (see separate issue on rewrite_published_post).Current behaviour (RuDS):
crates/bds-core/src/engine/post.rsfnupdate_post(~line 170): any call on a Published (or Archived — see separate unarchive issue) post flips status to Draft, even a no-op save or a template_slug-only change.Task: Implement the bDS2 condition: compare each supplied field against the current value (for published posts the current body must be resolved from the file when DB content is NULL — the reopen branch already reloads it). Only then demote to draft. Keep FTS/embedding sync on every update.
Acceptance: Tests: (a) update with identical values keeps status published, (b) title change demotes, (c) template_slug-only change keeps published, (d) content change demotes and DB content holds the draft body. Mirrors bDS2.
Implemented in
80f291b. Published posts now reopen to draft only when a supplied bDS2 published-content field actually differs: title, excerpt, body, author, language, tags, categories, or do-not-translate. Identical full editor saves and template-slug-only changes keep Published status and keep the database body NULL. Metadata-only changes hydrate the published file body into the reopened draft, and body changes persist the supplied draft body. FTS and embedding synchronization remains unconditional for every update. Added isolated regression coverage for identical saves, title changes, template-only changes, and body changes; verified against bDS2 and specs/post.allium. cargo fmt --check, Allium check/analyse, cargo machete, cargo build --workspace, and cargo test --workspace all pass.