Shared helper functions used across publishing submodules.
These functions were extracted to eliminate duplication between Posts, Versions, TranslationManager, and Groups.
Summary
Functions
Reads the current user's UUID from a LiveView socket's
phoenix_kit_current_scope assign. Returns nil when the LV is
mounted in a logged-out context (no scope, no user). LV callers
thread the result into mutating context functions as
actor_uuid: actor_uuid_from_socket(socket) so the activity log
records who initiated the change.
Reads a post back from DB using the appropriate method for the post's mode.
Functions
Reads the current user's UUID from a LiveView socket's
phoenix_kit_current_scope assign. Returns nil when the LV is
mounted in a logged-out context (no scope, no user). LV callers
thread the result into mutating context functions as
actor_uuid: actor_uuid_from_socket(socket) so the activity log
records who initiated the change.
@spec read_back_post( String.t(), term(), term() | nil, String.t() | nil, pos_integer() | nil ) :: {:ok, map()} | {:error, :not_found}
Reads a post back from DB using the appropriate method for the post's mode.
Used after create/update operations to return a consistent post map.