packagist verbb/comments 4.0.0

3 hours ago

{warning} Before upgrading to Comments 4, review the Upgrading from v3 guide for breaking changes and required migration steps.

Added

  • Add rich authoring through Editor, with an Authoring Mode setting that's rich on new installs. Sites upgrading from Comments 3 keep plain authoring, which writes in Comments' own lightweight editor, laid out the same, and saves plain text. Editor only loads once a visitor starts writing, opens a reply or edits a comment, and plain authoring never loads it. In both modes the editor keeps an unsent draft in the browser and shows Maximum Comment Length as a character limit. With rich authoring, commenters can format what they write, and signed-in commenters can mention people and attach images and files, with Allow Mentions, Allow Attachments, Attachment Volume, Attachment Subfolder, Allowed File Types and Maximum File Size settings. Attachment Subfolder can use the comment's properties in Twig, such as comments/{owner.section.handle}. Moderators edit comments in the control panel in the same editor, and a plain comment becomes rich there, as it does for its author, once its text is changed while rich authoring is on.
  • Add new spam protection through Protect: a randomised honeypot, a minimum form time, single-use forms, rate limits, a choice of Cloudflare Turnstile, reCAPTCHA v3, hCaptcha or Friendly Captcha challenges, and a choice of Akismet, CleanTalk or OOPSpam to classify spam, alongside the keyword filters. It applies to the site's comment form, the data API, the Comments 3 form actions and GraphQL. Akismet can also learn from moderators' corrections.
  • Add Maximum Links, which holds a comment with more links than you allow for review, and Blocked Email Domains, which refuses guests' comments from email addresses at the domains you list and their subdomains. (Anti-Spam)
  • Add rules to the keyword filters: [match: …] combines words and phrases with AND, OR and parentheses, such as [match: (viagra OR casino) AND cheap], and [ip: …] matches the visitor's IP address against addresses, ranges and CIDR blocks, such as [ip: 203.0.113.0/24]. Plain words keep working as before. A line starting with # is now a note, and saving a filter with a rule that can't be read shows which line is wrong. (Security)
  • Add Delete Spam After, which permanently deletes spam that hasn't changed for a number of days when Craft collects garbage. (Anti-Spam)
  • Add Hold First Comments, which holds each person's comments for review until a moderator has approved one of them, for sites that don't moderate every comment. (Moderation)
  • Add a Spam Protection page to the Comments section, and a Manage spam settings permission, so people other than admins can change spam settings.
  • Moderate in the Comments index, with Needs review, Reported and Spam sources, a Reason column saying why each comment needs someone, and a count of what's waiting in the navigation. Bulk actions approve, keep, remove, mark as spam or mark as not spam, and never delete permanently.
  • Add a first-run Comments page, shown until the first comment arrives in place of an empty index, that explains how to add comments to your templates, with the craft.comments.render() tag to copy and a link to the guide.
  • Add decisions to the comment editor's sidebar while a comment waits: Approve, Spam and Remove, or Keep and Remove for a reported comment, each saving any edits in one step. Removing asks for a reason from a short fixed list, with an optional private note. A notice at the top of the comment says why it's waiting or what it was reported for, and Preview shows it in its thread on the site.
  • Add a Commenters area for moderators, listing everyone who has commented with their counts, and a page for each person with their comments, an Activity tab of moderators' notes about them and what moderators have done, and their Review setting: Trusted, Normal, Held or Blocked. Trusted commenters skip pre-moderation, while spam checks and keyword filters still apply to them.
  • Keep what spam protection found on each comment it checks, so moderators can see which checks passed and what a provider said.
  • Add moderation on the public page, where moderators read held and reported comments in full, decide them in place, and see how many wait on that page.
  • Add an Activity tab to each comment in the editor, after its own fields: everything that's happened to it, newest first, with moderators' notes, which post straight away.
  • Add a Comments panel to owner elements' Comments field, with the comments waiting there to approve, mark as spam, keep or remove in place, the latest comments, and how many people follow the discussion.
  • Add Reply for moderators in the control panel, on a comment's page, in its slideout and in an element's Comments panel. The reply is posted as the moderator and published straight away, with the same notifications as a reply on the site. (Moderation) (#69)
  • Add a Start Closed setting to the Comments field, which closes elements without a setting of their own until an editor opens them, for sites where comments are opt-in. A Comments 3 field whose Default Value was off has it turned on.
  • Add guest subscriptions. Guests can subscribe to a discussion, or ask to be emailed about replies when they comment, after confirming their address.
  • Add an unsubscribe link and one-click List-Unsubscribe headers to every email about a discussion, for guests and people with an account alike. A link can stop that discussion's emails or all comment emails, and works without signing in or a cookie. (#273)
  • Add mention emails, with their own system message and a beforeSendMentionEmail event, sent once the comment is approved.
  • Add a Notifications::EVENT_AFTER_NOTIFY event, fired after a notification's emails and naming everyone it was for, for telling people through another channel as well, such as an in-app inbox. Cancelling an email through its beforeSend…Email event and listening here replaces the email with your own delivery.
  • Add deep links that reach a comment wherever it is: past the first page, below a collapsed reply or deeper than replies are shown. A link to #comment-123 loads its thread straight away and scrolls to it, whatever the load mode, and Comment::getPermalink() gives one.
  • Add a Load Comments setting (loadMode) and a loadMode option on craft.comments.render(), choosing whether a thread's comments load as a visitor scrolls near them, which is the default, when they press Show comments, or with the page. A link to a comment always loads its thread straight away. (Rendering Comments)
  • Add a CSS Layer setting (useCssLayers), which wraps the bundled stylesheet in @layer comments so a site whose own CSS uses cascade layers, such as Tailwind's, can place Comments below its utilities. (Theming)
  • Add a global Comments object to the browser, with mount() and mountThread(), which return promises because the renderer may still be loading, destroy(), get(), configure() and setTheme(), and comments:* browser events such as comments:comment-created, and comments:editor-opened once a reply or edit form is ready to use. (#320)
  • Add a cancelable comments:before-submit browser event for checking a comment before it's posted, and showFormErrors() and clearFormErrors() on each thread's controller to show errors the same way as the server's. (Validating Before Posting)
  • Add support for bundling the comments script into a site's own build through @verbb/comments-browser and its TypeScript types, a data-comments-auto-mount="false" attribute for starting threads yourself, and a guard so a page that loads the script twice only runs one copy. (Loading Comment Assets)
  • Add a JSON data API under comments/api/ for the comments script and a site's own clients. Its public reads (thread, replies, comment and structured-data) never look at who's asking, start a session or set a cookie, so a CDN, Blitz or Craft's data cache can hold them. Everything personal, such as each visitor's permissions and votes, an author's own comment while it waits for approval and a moderator's held and reported comments, comes from a private viewer read that's never cached, and a guest with no session gets a light answer from it that starts nothing. Pages continue from signed cursors, page sizes and depth are limited the same for everyone, writes take an operation ID so a repeated request never posts twice, and every response carries its API version, with errors given stable codes. Threads can be asked for by an element's URI as well as its ID.
  • Add front ends on other domains to the data API, listed under Allowed Origins (allowedOrigins) on a new Other Sites settings page. Any site can read public comments. A sibling subdomain listed with Shared Cookies signs members in through Craft's own session, guests on a listed site post through a short-lived guest session rather than a cookie, and a site listed with Member Tokens signs its members in with 15-minute tokens that its own server requests, signed with a Member Token Key (memberTokenKey, with memberTokenPreviousKey for changing it without downtime). A token only works from the site it was requested for, can't moderate unless that site has Moderation turned on, and stops working when it's revoked through comments/api/revoke-member-tokens or craft comments/member-tokens/revoke, or when its member is suspended or changes their password. A listed site can also have its own Turnstile or reCAPTCHA keys. In config/comments.php, an origin given as a plain string, as Formie's allowedOrigins takes it, is read as that origin with every switch off.
  • Add a session read to the data API, which says who's signed in and gives the CSRF token, so a guest's first vote, report or follow works before they've opened the form. The data API's comment read and commentsComment in GraphQL also find a comment by the number in its link (#comment-123), and say which element and site it's on, and viewer takes those numbers alongside UIDs.
  • Add comments/api/mentions and comments/api/upload for Editor's mention search and uploads, so they work under the same sign-in as the rest of the data API, including for members on other domains.
  • Refuse SVG, HTML, XML and script uploads whatever Allowed File Types lists, along with any file whose contents don't match its extension, and keep only what draws an image, removing its metadata, including where a photo was taken, before it's stored. Attachment Volume warns when uploads would be served from the site's own address. Uploads are turned off while Craft's temporary upload filesystem has public URLs, since files wait there unchecked until their comment is posted.
  • Accept HEIC and AVIF images when the server has PHP's Imagick extension, which removes their metadata, including where a photo was taken, before they're stored. Without it they're refused with a message saying why, and TIFF images are always refused. The Allowed File Types setting says which applies on your server.
  • Add commentsThread, commentsReplies, commentsComment and commentsViewer GraphQL queries returning the same data as the data API, and a commentsData field on comments. GraphQL mutations gain an operationId argument for safe retries, uid as well as id, parentUid and notifyReplies on createComment, vote on voteComment and withdraw on flagComment to set a vote or report rather than toggle it, following and email on subscribeComment, and note, keep and hold on moderateComment. Their errors carry the data API's error code in extensions.
  • Add craft.comments.structuredData(), which outputs schema.org JSON-LD for an element's approved comments so search engines can read them without running scripts. Commenters' names are left out unless includeAuthors is set, and an id option attaches the comments to the node an SEO plugin already outputs.
  • Add Api::EVENT_DEFINE_COMMENT_DATA and Api::EVENT_DEFINE_VIEWER_DATA events for adding a site's own public data to each comment and private data to the viewer's, and a Comments::EVENT_DEFINE_BADGES event for adding badges such as “Verified buyer” beside a commenter's name. (#155)
  • Add a new default thread design. The editor comes first, as a line beside your avatar that opens when you click into it and says who you're posting as, and replies open in place under their comment with who they're to, Cancel and Reply. Guests can sign in or comment as a guest, giving their name and email at the top of the editor. Actions are quiet, with counts hidden at zero and the rest in a menu, people without a photo get their initials on a colour, short public field values such as a location sit after a comment's time, and tapping the time shows the full date.
  • Add The Comment Form and Answers on Comments settings (formFields) under Comment Fields, each with a live preview, for the custom fields people fill in on the site's comment form and where their answers show. Each field can be asked for or not, and an answer shows beside the date, under the comment's text, or not at all, which keeps it private to moderators in the control panel and to the comment's author when they edit it. Fields take the widths set in the field layout. Fields placed before the Comment element in the field layout, such as a rating, are asked for above the comment box, and the rest below it, with the box and its toolbar outlined together. Fields can be left off replies, field layout conditions decide who's asked for each one, and each comment keeps the fields it was posted with for later edits. A value is only shown if it was entered while its field was set to show, so showing a field that wasn't shown never publishes what was entered privately. Plain text, number, email, link, date, dropdown, multi-select, radio buttons, checkboxes, lightswitch and Assets fields are supported, and the settings page says why any other field can't be used.
  • Add comment.shownFields for templates, which gives the values a comment shows, with their labels and formatted text, and never one that isn't shown.
  • Add FormFields::EVENT_REGISTER_FORM_FIELD_TYPES, for a plugin or module to describe how its own field type is filled in on the site's comment form and shown on a comment.
  • Add uploads for Assets fields on the comment form through comments/api/upload with the field's handle, honouring the field's file kinds and limits and Maximum Attachment Size under the same rules as attachments. Guests are only offered Assets fields with the new Guests Can Upload Files setting (allowGuestFieldUploads), which is off by default, and then each upload is checked like a comment and limited per address. Guests only attach their own uploads, and uploads that are never posted are removed after a day, or two hours for a guest's. The settings page warns when a collected field's files are stored where anyone can reach them.
  • Add an Interaction Mode setting with likes, upvotes and downvotes, or neither, and a Top sort ranked by score.
  • Add rate limits for votes, reports and guest subscriptions, per user for signed-in visitors and per network for guests.
  • Add an Author Edit Window setting that limits how long authors can edit or delete their own comments, and an “Edited” label on comments changed after posting.
  • Add configurable Author and Staff badges, with staff chosen by user group.
  • Add Report this comment, with a configurable list of Report Reasons and their explanations. The dialog quotes the comment, has no default reason and an optional box for anything else.
  • Add a button to collapse a comment's replies, a confirmation before authors delete a comment, and remembering a returning guest's name and email.
  • Add light, dark and automatic themes with a Theme setting, where “None” loads only the base styles the thread needs to work. Each theme is drawn from documented --comments-* CSS custom properties that a site's own stylesheet overrides in every theme, and icons keep their size without the bundled CSS. (Theming)
  • Add a Closed option to the Comments field, which stops new comments on an element while leaving existing ones visible.
  • Add a compatibilityMode setting, on by default, which keeps Comments 3's Twig helpers, comment methods, structure and trashed query parameters, GraphQL arguments and fields, comments/comments/trash action, console commands, vote, flag and subscribe events and browser event names working after an upgrade, each with a deprecation warning. Comments 3's GraphQL clients can still post without spam protection evidence, checked by everything except replay protection, and their userId and commentDate arguments are accepted and ignored. (Upgrading from Comments 3)
  • Add a View commenters’ email addresses GraphQL schema permission, which gives a private schema the email field and argument. Upgrading gives it to every private schema that could view comments. Public schemas never have them.
  • Add Interactions::EVENT_BEFORE_VOTE and EVENT_AFTER_VOTE, Reports::EVENT_BEFORE_REPORT, EVENT_AFTER_REPORT and EVENT_AFTER_WITHDRAW_REPORT, and Subscriptions::EVENT_AFTER_CHANGE_SUBSCRIPTION, which replace Comments 3's vote, flag and subscribe events, and can stop a vote or a report. (Events)
  • Add a guest confirmation system message.
  • Add contentFormat, contentHtml, contentDocument, editedAt, moderationState, rootId and depth to GraphQL comments, a commentConversation query, reason and details on flagComment, a protection argument on createComment and saveComment, and a moderateComment mutation behind a new schema permission.
  • Add author and viewer to GraphQL comments, giving the name, avatar and badges the thread shows without needing access to users, and what the person asking can do with each comment and how they voted. commentConversation also gives the interaction mode, character limit, guest policy, report reasons and what the person asking can do there. (GraphQL)
  • Add hasVoted(), hasUpvoted() and hasDownvoted() to comments, saying whether the current visitor has voted on one and which way. (#250)
  • Add craft.comments.getSummary() and craft.comments.getConfig() Twig functions, and conversationId, identityId, moderationState, rootId, parentId and hasOpenReports query params.
  • Add comments/diagnostics/scan and comments/diagnostics/rebuild-counts console commands.
  • Add an Upgrade Report settings page, shown after upgrading if there's anything to report, including settings that were in use and no longer exist.
  • Add a Restore action to the Comments index, for users who can trash comments, as trashed comments couldn't be restored.

Changed

  • The spam settings, including the keyword filters and provider keys, move from Settings to their own Spam Protection page and are now saved in each environment's database rather than project config, so they can be changed on production with admin changes turned off. The upgrade copies each environment's values from its project config, and config/comments.php still overrides them. (Upgrading from Comments 3)
  • Replace the recaptchaEnabled setting with challengeProvider. A recaptchaEnabled in config/comments.php keeps working, with a deprecation warning.
  • Hide After Reports (flaggedCommentLimit) and Hide After Downvotes (downvoteCommentLimit) now fold a comment away with a Show comment button, rather than hiding its text, and leave it published, so reported comments still wait for a moderator. With Show Author Score, they're off on new installs, and sites upgrading from Comments 3 keep their values, or Comments 3's defaults if they never changed them.
  • Guests' addresses from Comments 3 count as confirmed when upgrading, so their reply emails carry on, unless the address belongs to a user. New guests confirm theirs before they're emailed.
  • GIF search now runs in each visitor's browser, as GIPHY's API terms require, rather than through the site, so the GIPHY API Key is included in the page for anyone who can comment. The picker works with plain and rich authoring, where it's a GIF button in Editor's toolbar, shows “Powered by GIPHY”, keeps each GIF's size so the thread doesn't jump, and loads only when opened. Posted GIFs fit a square set by the theme's --comments-gif-max-size token, 15rem by default. Commenters can change or remove a GIF when editing, the data API reads and sets GIFs, and moderators can remove one from the control panel. See GIFs from GIPHY.
  • Use Gravatar now only looks up signed-in users and guests who've confirmed their email, after a user's own photo, and the site fetches each image in the queue and serves it itself, so visitors never contact Gravatar and an address's hash is never in the page. Images are G-rated and SHA-256 hashed. See Gravatar.
  • Comment::getParent() (comment.parent) now returns the parent only when it's approved, and getReplies(), children and getDescendants() only approved replies, as Comments 3's children did, so a template walking a thread from approved comments never shows a held one. Use getParentComment(), or status(null) on getReplies(), for every status. (Upgrading from Comments 3)
  • Comments now requires Craft 5.10 or greater. It also requires verbb/editor and verbb/protect, which Composer installs with it. PHP 8.2 and Verbb Base 3.0.20 are unchanged.
  • Comments are now drawn in the browser by the comments script, from the data API, rather than by Twig templates. craft.comments.render() outputs only a light mount point with the comment count, so every page with comments can be cached by anyone, and the script fetches the thread as a visitor nears it. Visitors need JavaScript to read and post comments, and craft.comments.structuredData() puts approved comments in the page for search engines. Customise the thread with themes and CSS custom properties, the stable comments__* class names, themeConfig for buttons and inputs, browser and PHP events, and part overrides. (Theming)
  • Replace the public CSS and JavaScript, including their class names and script API. Anything written against the cc-* classes, data-role attributes or Comments.Instance needs updating.
  • The site's comment form, the data API and GraphQL now only accept custom fields the site's form asks for, under The Comment Form, and only from people the field layout's conditions show them to, so set any your forms use. Required fields that aren't offered to someone no longer block their comment. Sites upgrading from Comments 3 start with no field asked for, and the Upgrade Report says so.
  • GraphQL schemas that can't moderate comments, and requests by someone who can't, now only read the custom fields a comment shows publicly, and get null for the rest, including relation fields. They can't search comments by custom fields, order them by anything but their own columns, filter them by related elements while the Comment layout has a relation field, or find elements related to a comment.
  • The Comments 3 form actions now only answer site requests, not requests through the control panel's URL.
  • The Comments 3 form actions comments/comments/save, vote, flag and subscribe now follow the data API's rules. Comments can only be posted on a live element that isn't a comment, with comments turned on, replies only to an approved comment on the same element, and edits only by the comment's author within the edit window. Blocked commenters can't follow a discussion or a comment's replies, and only approved comments' replies can be followed. A refused save answers JSON with success: false and errors, or renders the page again with errors keyed comment and by field and a comment of plain values holding only what was posted, no longer a comment element, rather than failing with an error page. (Upgrading from Comments 3)
  • The Comments 3 form actions' JSON answers no longer include the vote, flag and subscribe models, and redirects after a plain form post only follow the referring page when it's on the site's own address, going to the page posted to or the home page otherwise.
  • Custom fields on the Comment field layout can no longer use handles Comments uses itself, such as comment, email, name, ownerId, parentUid, notifyReplies and operationId. A field that already has one can't be collected on the site until its handle changes.
  • Custom forms need updating for the new protection fields: pass the element and site to craft.comments.protect(), and remove any old __UAHASH, __JSCHK, __HPP and __TIME fields.
  • craft.comments.render() now takes the element or its ID, and the options siteId, sort, limit, loadMode, themeConfig, fields and nonce as its second argument, ignoring anything else. A draft or revision shows the comments of the element it belongs to. It outputs nothing for an element that isn't live. It no longer sets properties on a comment query, and its third argument is ignored.
  • Comments now load in the browser as a visitor scrolls near them, rather than with the page, so they aren't in its initial HTML for search engines that don't run scripts. Set Load Comments to With the page to keep them there. The Upgrade Report mentions this after upgrading.
  • Guests are now only emailed once they've confirmed their address, including replies to their comments.
  • The Trashed comment status is now Removed, separate from Craft's trash. Comment::STATUS_TRASHED is now Comment::STATUS_REMOVED, so update any templates or queries using trashed.
  • Close Comments Globally now keeps existing comments visible, and turning comments off for an element now hides them.
  • Blocked commenters can no longer vote, report or follow a discussion, as well as not posting in it, and closed conversations no longer take votes, though comments in them can still be reported and followed. This applies to the site, the data API, GraphQL and the Comments 3 form actions.
  • GraphQL comment mutations are now refused over GET, and on a public schema need the page's CSRF token when the request carries a Craft session or a guest's cookie, so another site can't make a visitor's browser post, vote, report, follow or delete for them. Holding or approving a removed comment through moderateComment now needs the same permission as restoring it.
  • GraphQL public schemas now only return published comments, whatever arguments are supplied, including through the children and parent fields. saveComment can now only change a comment's content, and only for its author. createComment and saveComment now need protection evidence while spam checks are on.
  • Upgrading now runs in small batches that can resume after a timeout or failure, and verifies the migrated data before removing anything, stopping if it doesn't match. Comments 3 votes, flags, subscriptions and structure are kept in comments_v3_* tables, without IP addresses, and can be dropped afterwards.
  • Threads no longer use a Craft structure. Use depth, rootId, parentId and getReplies() in place of level, getAncestors() and similar.
  • Replace allowVoting with interactionMode. Upgraded sites with voting on keep upvotes and downvotes, and new installs default to likes.
  • Staff notifications leave out whoever caused them, so moderators aren't emailed about their own comments, edits or reports.
  • beforeSendAdminEmail and beforeSendFlagEmail now give the recipient as a user in $event->user, rather than an array. An address that doesn't belong to an account is a user without an ID.
  • Consolidate the notification settings into participantNotifications, staffNotifications, subscriptionTypes and subscriptionDefault, and rename notificationAdmins (Comment Administrators) to notificationRecipients (Notification Recipients). Existing settings are translated when loaded, and removed the next time settings are saved.
  • useQueueForNotifications now defaults to on, so make sure your site's queue is running.
  • Replace getVotes(), getFlags() and getSubscribe() on the plugin class with getInteractions(), getReports() and getSubscriptions(), and getProtect() with getProtection().
  • Moderators changing a comment's status no longer saves its element, so Comment::EVENT_AFTER_SAVE doesn't fire for that. Use the new Moderation::EVENT_AFTER_CHANGE_STATE event instead.
  • Call flags reports throughout. A comment now counts as reported as soon as it has an open report.
  • Grant the new comments-view and comments-moderate permissions to users and user groups who held the matching Comments 3 permissions. Plugin access no longer reaches comments without comments-view.
  • Client IP addresses now come from Protect, which only trusts forwarded headers from proxies listed in Craft's trustedHosts. A site behind a proxy or CDN needs this set, or every visitor shares one address. (Security)
  • Manage comments through Craft's native element index and editor, including slideouts, with moderation and element type sources, and date, report and vote columns. The editor's sidebar lets you move a comment and its replies to another element, change its author, and links its commenter's page. Moderators without comments-edit see a comment read-only.
  • Commenters' email addresses are now only shown to admins. Other users no longer see the Email column in the Comments index, or can search, filter or sort comments by address. GraphQL's orderBy can't sort by address, IP address, browser or protection record either, except for admins and private schemas allowed to view addresses.
  • Replace the sidebar on owner elements with a Comments field you add to a field layout, with options to follow the source setting, open, close or turn off comments. It also lists the element's waiting, reported and latest comments, which its Show Comments Summary setting can turn off.
  • A Comments field switched off in Comments 3 is now read as Closed, which is what Comments 3 did with it, so the element's comments stay visible and new ones are stopped.
  • Reorganise settings into General Settings, Authoring, Comment Fields, Commenting, Interactions, Notifications, Moderation, Spam, Appearance, and CSS & JavaScript. Commenting holds where comments are allowed, guest settings and limits, and reporting settings are now under Interactions.
  • Bundled CSS and JavaScript are now published by Craft as asset bundles, including on Craft Cloud. Settings are now labelled Load Bundled CSS and Load Bundled JavaScript, and turning off Load Bundled JavaScript keeps rich authoring working for a site that bundles the script itself.
  • Errors are now shown next to the field they're about, a new comment now appears at the top unless sorted oldest first, and comment headings now count the whole discussion.
  • Marking a comment as not spam now returns it to Pending, so publishing it is a separate decision.

Fixed

  • Fixed a low-severity information disclosure vulnerability.
  • Fixed a low-severity HTML injection vulnerability.
  • Comments deleted by their authors are no longer returned as approved. They have a new author-removed status.
  • Fix comments and guest names with emoji failing to save on databases that haven't been converted to utf8mb4. Comments checks each of its own tables, which can differ from Craft's, and stores emoji as shortcodes in a table that can't hold them. They're shown as emoji everywhere, as are emoji from Comments 2. (Upgrading from Comments 3)
  • Fix keyword filters also matching a comment's status and format, ignoring words with accented characters, and matching case-sensitively in exact mode.
  • Fix Maximum Comment Length counting bytes and refusing a comment of exactly that length.
  • Fix vote and flag buttons being shown to guests when they aren't allowed to use them.
  • Fix comments on auto-closed elements being accepted when posted to comments/comments/save directly.
  • Fix the dashboard widget showing nothing until its settings were saved, and hiding flagged comments unless asked to show only those.
  • Fix approving, holding and re-approving a comment resending every notification, notifications being sent for comments removed before the queue job ran, and people receiving more than one email for the same comment. Each person now gets one email per comment.
  • Fix failed notification emails leaving the queue job marked as successful. All recipients are still tried, then the job fails so it shows up in the queue manager.
  • Fix the German email to moderators about an edited comment describing an approval.
  • Fix notification emails having no plain text part.
  • Fix votes and flags being accepted on unpublished comments.
  • Fix authors with no full name showing a blank name.
  • Fix an error when commenting on a user while specific user groups are selected in the permissions settings.
  • Fix GraphQL createComment being registered under the name saveComment.
  • Fix GraphQL voteComment ignoring its downvote and siteId arguments, flagComment ignoring siteId, the user field on flags, and createComment keeping a name and email for signed-in users.
  • Fix GraphQL schemas with only the save or delete comment scopes having no mutations available.
  • Fix finding flagged comments erroring on PostgreSQL.
  • Fix comments failing to post from browsers that send a long user agent, such as Instagram's in-app browser, and very long guest names or comments failing with an error instead of a message.

Removed

  • Remove the thread's Twig templates and the Template Folder Override setting (templateFolderOverride), as threads are drawn with JavaScript. A templateFolderOverride left in config/comments.php is ignored with a deprecation warning. The Upgrade Report lists any thread template files a site overrode, from the folder the setting named or templates/_comments, with a link to the upgrade guide. (Upgrading from Comments 3)
  • Remove reading and posting comments without JavaScript in the thread craft.comments.render() outputs, which visitors without it see as the comment count and a line asking them to turn it on. A site's own forms can still post to the Comments 3 form actions without JavaScript.
  • Remove the defaultQueryStatus, hideVotingForThreshold, showCustomFieldNames, showCustomFieldInstructions, assetBaseUrl, assetBasePath, indexSidebarLimit, indexSidebarGroup and indexSidebarIndividualElements settings. Public forms always show field labels.
  • Remove Comment::can() and Comment::canTrash(), which compatibility mode keeps.
  • Remove the _special templates, the commentsInclude() and commentsSiteInclude() Twig functions, and craft.comments.renderCss(), renderJs() and getJsVariables().
  • Remove the comments/comments/trash, get-js-variables, giphy-search (GIPHY's terms require visitors' browsers to search GIPHY directly), edit-comment, save-comment, edit-comment-slideout and delete-comment controller actions, and the html key from JSON responses to comments/comments/save. Use the data API's comments/api/delete and the other comments/api/* actions instead. comments/comments/save, vote, flag and subscribe stay for a site's own forms, answering JSON when asked and otherwise redirecting back with Craft's own notice and error messages.
  • Remove email from the GraphQL CommentInterface and the email argument from the comments query, and sessionId and lastIp from GraphQL votes and reports. A comment's flags count is now only on schemas that can moderate, for someone who can moderate, and public schemas no longer accept identityId as an argument or sort.
  • Remove the userId, commentDate and newParentId arguments from GraphQL comment mutations, and structure arguments and fields from GraphQL comments, in favour of parentId, rootId and depth, with parentId also narrowing the comments query to the direct replies of a comment.
  • Remove the comments/base/publish-assets, comments/base/resave-structure and comments/base/set-structure console commands, and the Publish now settings button.
  • Remove the FlagEvent, VoteEvent and SubscribeEvent classes and the FlagNotFoundException, VoteNotFoundException and SubscribeNotFoundException classes, which nothing used.
  • Remove RenderCache::getCommentIds() and setCommentIds(), which nothing used.
  • Remove renderComment(), getRenderVariables(), getRenderJsVariables(), publishFrontEndAssets() and getComponentTemplatePath() from the comments service, as threads are drawn in the browser.
  • Remove the comments/new control panel routes, which never opened a form. Moderators reply from a comment's page instead, and new discussions start on the site.

Don't miss a new comments release

NewReleases is sending notifications on new releases.