Optional seam to phoenix_kit_comments — same posture as the
phoenix_kit_og plugin seam: publishing has NO dep on the comments
package; every call is Code.ensure_loaded? + function_exported?
guarded and rescued, so a host without the module (or with it disabled
from /admin/modules) renders publishing pages with no comments UI and
no crashes.
Comments attach to resource_type: "publishing_post" with the post uuid,
matching the ecosystem convention (staff/CRM tabs, core's media
annotations). Public commenting is logged-in only for now — the
comments schema requires a user_uuid; guest commenting needs a
comments-module change (tracked in the roadmap as a cross-repo
follow-up).
Summary
Functions
True when the comments module is installed AND enabled.
The comments module's one-per-page markdown styles, or nothing.
Published-comment count for a post.
Creates a comment on a post for a logged-in user. Returns the comments
module's result verbatim ({:ok, comment} or {:error, reason} —
:content_too_long, :empty_comment, :max_depth_exceeded, …).
Everything the post page needs in one read, pre-partitioned
Published comments for a post, oldest first, with authors preloaded.
Renders a comment's markdown content — the comments module's sanitized
comment_markdown/1 component when available, escaped plain text with
line breaks otherwise.
Total node count of a comment tree (a panel's thread size).
Functions
True when the comments module is installed AND enabled.
The comments module's one-per-page markdown styles, or nothing.
Published-comment count for a post.
Creates a comment on a post for a logged-in user. Returns the comments
module's result verbatim ({:ok, comment} or {:error, reason} —
:content_too_long, :empty_comment, :max_depth_exceeded, …).
Options
:parent_uuid— makes this a reply. The parent must be a published comment on the SAME post (the comments module computes depth from the parent but does not check resource ownership — a crafted uuid could otherwise thread onto another post's comment). A reply inherits its parent'snote_id, so a thread never straddles the main list and a note panel.:note_id— anchors the comment to an author note (posted from the note's slide-out panel). Stored inmetadata["note_id"].
Everything the post page needs in one read, pre-partitioned:
:thread— the main comment thread as a nested tree (each comment gets a:childrenlist), replies attached viaparent_uuid;:note_comments—%{note_id => [comments]}for comments carrying ametadata["note_id"](posted from a note's slide-out panel), each note's list a nested tree like the main thread (replies inherit the parent's note_id, so a whole thread lives in one panel);:count— main-thread comment count (replies included, note comments excluded — the "N comments" header describes the thread the reader is looking at).
Published comments for a post, oldest first, with authors preloaded.
Renders a comment's markdown content — the comments module's sanitized
comment_markdown/1 component when available, escaped plain text with
line breaks otherwise.
Total node count of a comment tree (a panel's thread size).