diff options
Diffstat (limited to 'app/models')
| -rw-r--r-- | app/models/node.rb | 8 | ||||
| -rw-r--r-- | app/models/node_action.rb | 11 |
2 files changed, 19 insertions, 0 deletions
diff --git a/app/models/node.rb b/app/models/node.rb index 7a93e799..0a9cd2d1 100644 --- a/app/models/node.rb +++ b/app/models/node.rb | |||
| @@ -501,6 +501,14 @@ class Node < ApplicationRecord | |||
| 501 | to_attach.each do |row| | 501 | to_attach.each do |row| |
| 502 | row.related_assets.create!(:asset => asset, :headline => headline_state == :set) | 502 | row.related_assets.create!(:asset => asset, :headline => headline_state == :set) |
| 503 | end | 503 | end |
| 504 | |||
| 505 | if to_attach.any? | ||
| 506 | metadata = { :asset_name => asset.name, | ||
| 507 | :path => asset.upload.url.sub(/\?\d+$/, "") } | ||
| 508 | metadata[:headline] = true if headline_state == :set | ||
| 509 | NodeAction.record!(:node => self, :participants => [self, asset], | ||
| 510 | :user => user, :action => "asset_attach", **metadata) | ||
| 511 | end | ||
| 504 | end | 512 | end |
| 505 | 513 | ||
| 506 | { :attached => to_attach.size, | 514 | { :attached => to_attach.size, |
diff --git a/app/models/node_action.rb b/app/models/node_action.rb index 9ed0b628..aa52f489 100644 --- a/app/models/node_action.rb +++ b/app/models/node_action.rb | |||
| @@ -69,6 +69,17 @@ class NodeAction < ApplicationRecord | |||
| 69 | # "path" -- final path, flat string (create-symmetric) | 69 | # "path" -- final path, flat string (create-symmetric) |
| 70 | # "destroyed_descendants" -- integer, only when positive; one entry | 70 | # "destroyed_descendants" -- integer, only when positive; one entry |
| 71 | # at the root, per the subtree rule. | 71 | # at the root, per the subtree rule. |
| 72 | # | ||
| 73 | # "asset_create" (witnessed upload; participants: the asset alone): | ||
| 74 | # "asset_name", "content_type", "path" -- flat strings | ||
| 75 | # | ||
| 76 | # "asset_attach" (out-of-band attach via Node#attach_asset!; written | ||
| 77 | # only when at least one new join was created, per the tandem rule -- | ||
| 78 | # in-editor curation stays draft-scoped and surfaces at publish. | ||
| 79 | # participants: the node (primary) and the asset): | ||
| 80 | # "asset_name", "path" -- flat strings | ||
| 81 | # "headline" -- boolean, only when set by this attach | ||
| 82 | # | ||
| 72 | # "asset_destroy" (witnessed asset deletion; always written, even for | 83 | # "asset_destroy" (witnessed asset deletion; always written, even for |
| 73 | # unattached assets -- the files were publicly reachable; node column | 84 | # unattached assets -- the files were publicly reachable; node column |
| 74 | # nil, subjects via participants: the asset plus every then-attached | 85 | # nil, subjects via participants: the asset plus every then-attached |
