Comments 0.6.0: A compact comment thread, paste-to-attach and safer moderation for Phoenix
Comments 0.6.0 redesigns the PhoenixKit threaded comments module for Phoenix LiveView: a compact thread that reads like a modern chat, files you can paste or drop straight into a comment, and a moderation workflow that refuses changes that make no sense.
A compact, modern comment thread
The thread no longer sits in a card. Each comment is a flat row with a small avatar, the name and a live “time ago” on one line, and the actions stay quiet until you hover (they are always shown on touch screens). Replies hang off a line under their parent, attachments show as a strip of thumbnails, and the editor grows with its text. A new comment appears next to the box it was written in: a box at the top lists the newest first, a box at the bottom the oldest first and follows the conversation while the reader is at the bottom.
The compact thread in Comments 0.6, here on a task in the Projects module.
Attach by pasting or dropping
A paste that carries files and no text, or a file dragged in from the desktop, becomes an attachment with the same limits as the attach button. Voice notes now use PhoenixKit’s own audio recorder and are staged like any other file. Images shown inline in a comment are limited to this site and Giphy over HTTPS; any other image becomes a link, so reading a comment never makes the browser fetch another third party’s image.
Pasted images arrive as attachments, shown as a strip of thumbnails.
Moderation you can trust
Status changes are now decided on the stored comment: approving or hiding a deleted comment, restoring one that is not deleted or deleting one twice are refused with a clear error, and bulk approve and hide go through the same checks as single comments. A hidden comment with published replies stays as a [removed] placeholder so the replies still make sense. This release also closes a hole where a comment could keep style and class attributes and draw over the page, and stops comment attachments from being taken for orphaned files and deleted.
The module is now translated into German, Spanish, French, Italian and Chinese, alongside English, Estonian and Russian.
Upgrading
Comments 0.6 needs PhoenixKit 3.5: run mix phoenix_kit.update; the module itself has no migration. The module’s own voice-recorder hook, PhoenixKitCommentsAudioRecorder, is gone, so remove any reference to it: voice notes now use core’s <.audio_recorder>. If your code creates or edits comments directly, check these changes: a comment’s status can no longer be set through the changeset (use Comment.put_status/2), invalid status transitions return errors such as {:error, :comment_deleted}, a reply to a comment on a different record is refused with {:error, :invalid_parent}, update_comment/3 changes only the content and metadata, and a status change to the state a comment is already in returns {:ok, comment} without firing callbacks, audit rows or broadcasts.
Full release notes: Comments 0.6.0
0.6.0 · 9 November 2026
Needs PhoenixKit 3.5.0 (run its mix phoenix_kit.update). No migration of this module’s own.
⚠️ To check in a host:
statusis server-only. NeitherComment.changeset/3nor the newComment.update_changeset/3casts it;Comment.put_status/2sets it, andcreate_comment/4/update_comment/3read it from an atom key only. String-keyed attrs tocreate_comment/4are read for"content","parent_uuid"and"metadata"only.- Status transitions refuse what makes no sense and are decided on the locked row: approve and hide a deleted comment →
{:error, :comment_deleted}, restore one that is not deleted →{:error, :not_deleted}, delete a deleted one →{:error, :already_deleted}. A transition to the current state returns{:ok, comment}with no callback, audit row or broadcast. - A reply to a comment on another record, or with a malformed parent, is refused with
{:error, :invalid_parent}. update_comment/3changes onlycontentandmetadata; it can no longer move a comment or change its author.
Changed
- Core pin raised to
>= 3.5.0 and < 4.0.0. Voice notes are now core’s<.audio_recorder>, recording into the composer’s own upload, so a clip is staged, limited and cancelled like any picked file; 3.5.0 is the first core that has it, and the floor makes sure no host loses voice notes by upgrading this module alone. The module’s own recorder hook (PhoenixKitCommentsAudioRecorder) is gone. - A compact thread. No card around it and no count in the title; flat rows with a small avatar, the name and a live, localised “time ago” on one line, the actions quiet until hover (always shown on touch); replies hang off a line under their parent; attachments as a thumbnail strip; an editor that grows with its text, the character count shown only near the limit.
- A new comment shows up next to its box. A box on top lists the newest first, a box at the bottom the oldest first and follows the newest while the reader is at the bottom (
order::autoby default, or:newest_first/:oldest_first). Replies keep the order they were written in. - A success (“Comment added”, deleted, updated) is a toast that leaves by itself; errors stay next to what failed. A comment posted as a person shows their face, only one posted as the project the project mark.
- A hidden or pending comment with published replies stays in the thread as a
[removed]placeholder, its text and media blanked byget_comment_tree/2itself, so the replies show again and the count matches what is shown. - Images in a comment stay inline only from this site or from Giphy over HTTPS; any other becomes a link, so reading a comment never makes the browser fetch a third party’s image.
bulk_update_status/3,bulk_approve/2andbulk_hide/2route each row through the matching single-row function, so callbacks, audit rows and refusals are the same as one by one.- Settings writes go through one
update_settings_batch/2carrying the actor; Reset no longer switches the module off or erases the Giphy key; the on/off switch is written only when it changed.
Added
- Translations for German, Spanish, French, Italian and Chinese (
de,es,fr,it,zh), and the English, Estonian and Russian catalogs completed and corrected. Permission and tab labels are translated too. - Pasted and dropped files become attachments. A paste carrying files and no text, or a file dragged in from the desktop, takes the attach button’s path with the same limits; where nothing can be attached the composer says why. A body still carrying an inline
data:image is refused. PhoenixKitComments.RemovalGuardanswers core’s file removal guard (config :phoenix_kit, :file_removal_guard, …), so the media page refuses to trash a file a comment shows.file_references/0(PhoenixKitComments.FileReferences): core 3.0’s orphan check no longer covered this module’s tables.PhoenixKitComments.moderation_enabled?/0,giphy_url?/1andComment.update_changeset/3/put_status/2. With moderation on, the poster is told the comment awaits approval.- The JS hooks’ own tests run inside
mix test(test/js_hooks_test.exs, when node is installed).
Fixed
- Comment attachments were taken for orphaned files on core 3.0, and “Delete all orphaned” trashed them.
- The thread’s messages were never shown: a LiveComponent’s
put_flashgoes nowhere. They render in the thread, where the person is looking, until their next action. - One crafted comment crashed every render of its thread (nested metadata in an attribute).
- The markdown sanitiser left
styleandclassonspan,code,pre(andclassondiv), so a comment could draw over the reader’s page. - Bulk moderation was unreachable: its bar sat outside core’s bulk-select scope and never showed.
- Hide undeleted a deleted comment, a crafted restore published a hidden one, and a repeated delete fired
on_comment_deletedand logged again. - Reactions deadlocked (like against undislike in two tabs). Every path locks the comment first; a switch fires both callbacks; counters clamp at zero.
- A missing author or comment raised
Ecto.ConstraintError(the changesets named the wrong foreign keys). A NUL byte in a body, metadata or a search raised from Postgres.list_all_comments/1raised onper_page: 0or a huge page, and a malformed user filter listed every comment. - An edit saved into a comment deleted or hidden meanwhile; a malformed or unknown event crashed the host page; a rejected upload left “Wait for uploads to finish.” on screen; a double-clicked ✕ on a staged file crashed the page;
composer_position: nilstill allowed replies;withhold_mention_titlesdid nothing; every keystroke re-rendered every comment’s markdown. - The voice recorder answered every thread on the page; the chat-scroll hook scrolled the page behind a drawer and ignored a comment link’s place.
- Admin path templates accepted an off-site (
//host) orjavascript:link; adding one overwrote what another admin had saved; an overflowing page number or crafted params crashed the moderation page. - A resource handler’s exception or exit was logged with the comment in it; now only its shape.
- PubSub topics and payloads lower-case the resource uuid, so a subscriber no longer misses a create sent with another spelling.
- A mixed-case migration prefix could not be re-run.
Comments 0.6.0. Install or update: {:phoenix_kit_comments, "~> 0.6"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.