PhoenixKit.Modules.Publishing.PublishingVersion (PhoenixKitPublishing v0.4.6)

Copy Markdown View Source

Schema for publishing post versions.

Versions are the source of truth for published state and metadata. Each post can have multiple versions (v1, v2, etc.). Each version contains per-language content rows in PublishingContent.

Status Flow

  • draft - Version is being edited
  • published - Version is live (post.active_version_uuid points here)
  • archived - Version replaced by newer one

Data JSONB Keys

Version metadata (defaults for all languages)

  • featured_image_uuid - Featured image reference (media UUID)
  • tags - List of tag strings
  • description - SEO meta description
  • allow_version_access - Whether older versions are publicly accessible
  • featured - Whether this post is featured (pinned to the top of the group listing and rendered larger). Per-group display is gated by the group's own featured_enabled/featured_layout config.

Version history

  • created_from - Source version number this was created from
  • notes - Version notes/changelog

Summary

Functions

Changeset for creating or updating a publishing version.

Returns whether older versions are publicly accessible.

Returns the post's audio-version file uuid (nil when none).

Returns the categories filed against this version.

Returns the source version number this was created from.

Returns the SEO description.

Returns whether this post is featured (pinned + shown larger on the group listing).

Returns the featured image UUID.

Returns version notes.

Returns the post tags.

Types

t()

@type t() :: %PhoenixKit.Modules.Publishing.PublishingVersion{
  __meta__: term(),
  contents: term(),
  created_by: term(),
  created_by_uuid: UUIDv7.t() | nil,
  data: map(),
  inserted_at: DateTime.t() | nil,
  post: term(),
  post_uuid: UUIDv7.t(),
  published_at: DateTime.t() | nil,
  status: String.t(),
  updated_at: DateTime.t() | nil,
  uuid: UUIDv7.t() | nil,
  version_number: integer()
}

Functions

changeset(version, attrs)

Changeset for creating or updating a publishing version.

get_allow_version_access(publishing_version)

Returns whether older versions are publicly accessible.

get_audio_uuid(publishing_version)

Returns the post's audio-version file uuid (nil when none).

A cleared audio picker submits "", and older rows still carry that blank. Blank normalizes to nil HERE so every reader agrees: an empty string is truthy in Elixir, so a template gating on the raw value rendered a player whose src had an empty uuid segment (/file//original/<token> — a dead request).

get_category_uuids(publishing_version)

Returns the categories filed against this version.

Version-level, like everything else here. A post's subject can genuinely change between versions — a release note that grows into a guide — and the old version keeps the filing it was published under, which is what someone reading ?v=2 should see. A new version inherits the whole data map from the one it was created from, so this carries forward by default and only differs where somebody changed it.

get_created_from(publishing_version)

Returns the source version number this was created from.

get_description(publishing_version)

Returns the SEO description.

get_featured(publishing_version)

Returns whether this post is featured (pinned + shown larger on the group listing).

get_notes(publishing_version)

Returns version notes.

get_tags(publishing_version)

Returns the post tags.