Class: PostRevisionSnapshotHandler
- Inherits:
-
Object
- Object
- PostRevisionSnapshotHandler
- Defined in:
- app/subscribers/post_revision_snapshot_handler.rb
Overview
Sync subscriber for Events::PostContentUpdated.
Creates an immutable ArticleRevision snapshot whenever a Post's content
fields change. Runs synchronously (PORO, not ApplicationJob) so revisions
are immediately visible after save — no async delay.
Registered before the async PostContentUpdatedHandler in event_store.rb,
so the snapshot exists before EmbeddedAssetSync/schema/cache work begins.
Instance Method Summary collapse
Instance Method Details
#call(event) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'app/subscribers/post_revision_snapshot_handler.rb', line 12 def call(event) post = Post.find_by(id: event.data[:post_id]) return unless post post.snapshot_revision!( change_notes: event.data[:change_notes], author_id: event.data[:updater_id] ) end |