diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-07-15 01:41:34 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-07-15 04:23:09 +0200 |
| commit | d56155231814633e04f856d22646fea24ef97011 (patch) | |
| tree | 9d5b6f8c32ee5b59783a2880388e7833278d1d87 /app/controllers | |
| parent | 28a6999b55cbec555696df848d6e924aae3166ee (diff) | |
node_id/page_id/user_id are lookup and ordering only -- all three
nullify on delete, so an entry outlives its actor and its subject.
Everything that must survive those deletions lives in a mandatory
metadata jsonb written once at creation: the actor's username, the
node's human-readable name (pinned to the default locale), and
action-specific extras such as publish's title from/to.
NodeAction.record! is the single constructor, so every entry gets
the same baseline metadata without each call site re-implementing
it. occurred_at is one field for live and backfilled entries alike;
inferred_from distinguishes them -- nil means witnessed at the
moment it happened, populated names how a backfilled entry was
estimated.
Instrumented so far: publish (crediting the actual publisher,
threaded through from the controller -- previously nobody had the
act of publishing recorded anywhere), revert's discard_autosave and
destroy_draft branches, and translation destroy. publish_draft! now
runs in a transaction so the promotion and its log entry land
together. The remaining verbs follow once this mechanism has proven
itself.
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/nodes_controller.rb | 2 | ||||
| -rw-r--r-- | app/controllers/page_translations_controller.rb | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/app/controllers/nodes_controller.rb b/app/controllers/nodes_controller.rb index bff1733..9c5d228 100644 --- a/app/controllers/nodes_controller.rb +++ b/app/controllers/nodes_controller.rb | |||
| @@ -147,7 +147,7 @@ class NodesController < ApplicationController | |||
| 147 | end | 147 | end |
| 148 | 148 | ||
| 149 | def publish | 149 | def publish |
| 150 | @node.publish_draft! | 150 | @node.publish_draft!(current_user) |
| 151 | flash[:notice] = "Draft has been published" | 151 | flash[:notice] = "Draft has been published" |
| 152 | redirect_to node_path(@node) | 152 | redirect_to node_path(@node) |
| 153 | end | 153 | end |
diff --git a/app/controllers/page_translations_controller.rb b/app/controllers/page_translations_controller.rb index 38a7c4f..be4f488 100644 --- a/app/controllers/page_translations_controller.rb +++ b/app/controllers/page_translations_controller.rb | |||
| @@ -63,6 +63,9 @@ class PageTranslationsController < ApplicationController | |||
| 63 | draft.translations.where(:locale => @locale).delete_all | 63 | draft.translations.where(:locale => @locale).delete_all |
| 64 | draft.reload | 64 | draft.reload |
| 65 | 65 | ||
| 66 | NodeAction.record!(:node => @node, :page => draft, :user => current_user, | ||
| 67 | :action => "translation_destroy", :locale => @locale) | ||
| 68 | |||
| 66 | flash[:notice] = "#{@locale.upcase} translation removed from the draft. Publish to make this permanent." | 69 | flash[:notice] = "#{@locale.upcase} translation removed from the draft. Publish to make this permanent." |
| 67 | redirect_to node_path(@node) | 70 | redirect_to node_path(@node) |
| 68 | rescue LockedByAnotherUser => e | 71 | rescue LockedByAnotherUser => e |
