Skip to main content

Module page_subscription

Module page_subscription 

Source
Expand description

Per-user opt-in subscriptions to page publish events.

Editors / stakeholders subscribe to pages they care about and receive an email when the page transitions into Published. Fires from the same three publish paths the after_publish_page hook does (single page edit, bulk publish, workflow auto-publish).

Notification delivery is best-effort and depends on the host having wired a mailer via router_with_mailer / with_mailer_from. Hosts that haven’t wired one log a debug line and skip — no invariants broken.

Structs§

PageSubscription

Functions§

is_subscribed
Whether user_id has an active subscription on page_id.
notify_pre_publish
Fan out a pre-publish reminder. Called from the schedule sweep when a page’s go_live_at is within the next hour. Same muting + actor-skip semantics as notify_publish.
notify_publish
Fan out a publish notification to every subscriber of page_id. Best-effort — if the mailer is missing or any send fails, the publish itself is unaffected.
render_pre_publish_notification
Compose the subject + body for the pre-publish reminder. Mirrors render_publish_notification but flags that the publish hasn’t happened yet so subscribers can intervene.
render_publish_notification
Compose the publish-notification subject + body for one page.
subscribe
Subscribe user_id to publish events for page_id. Idempotent — re-subscribing does not insert a duplicate row.
subscribers_for_page
Every subscriber of page_id. Used by the notification fan-out when a page publishes.
unsubscribe
Remove user_id’s subscription on page_id. No-op when no row exists. Returns the number of rows deleted (0 or 1).