diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 1e05ab69c3..f91acd86bb 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -24,6 +24,7 @@ Changelog * Fix: Ensure there is a visual difference of 'active/current link' vs normal links in Windows high-contrast mode (Mohammad Areeb) * Fix: Avoid issues where trailing whitespace could be accidentally removed in translations for new page & snippet headers (Florian Vogt) * Fix: Make sure minimap error indicators follow the minimap scrolling (Thibaud Colas) + * Fix: Remove the ability to view or add comments to `InlinePanel` inner fields to avoid lost or incorrectly linked comments (Jacob Topp-Mugglestone) * Docs: Add custom permissions section to permissions documentation page (Dan Hayden) * Docs: Add documentation for how to get started with contributing translations for the Wagtail admin (Ogunbanjo Oluwadamilare) * Docs: Officially recommend `fnm` over `nvm` in development documentation (LB (Ben) Johnston) diff --git a/client/src/entrypoints/admin/comments.js b/client/src/entrypoints/admin/comments.js index 76f979e08f..e3020e868f 100644 --- a/client/src/entrypoints/admin/comments.js +++ b/client/src/entrypoints/admin/comments.js @@ -19,7 +19,7 @@ window.comments = (() => { function getContentPath(fieldNode) { // Return the total contentpath for an element as a string, in the form field.streamfield_uid.block... - if (fieldNode.closest('data-contentpath-disabled')) { + if (fieldNode.closest('[data-contentpath-disabled]')) { return ''; } let element = fieldNode.closest('[data-contentpath]'); @@ -163,10 +163,14 @@ window.comments = (() => { throw new MissingElementError(annotationTemplateNode); } this.annotationTemplateNode = annotationTemplateNode; - this.shown = false; + this.updateVisibility(false); } register() { + if (!this.contentpath) { + // The widget has no valid contentpath, skip subscriptions + return undefined; + } const { selectEnabled } = commentApp.selectors; const initialState = commentApp.store.getState(); let currentlyEnabled = selectEnabled(initialState); @@ -300,9 +304,7 @@ window.comments = (() => { commentAdditionNode: buttonElement, annotationTemplateNode: document.querySelector('#comment-icon'), }); - if (widget.contentpath) { - widget.register(); - } + widget.register(); }; // Our template node may not exist yet - let's hold off until comments are loaded and enabled onNextEnable(initWidget); diff --git a/docs/releases/4.2.md b/docs/releases/4.2.md index 6cee6841e7..00fe0a5693 100644 --- a/docs/releases/4.2.md +++ b/docs/releases/4.2.md @@ -36,6 +36,7 @@ depth: 1 * Ensure there is a visual difference of 'active/current link' vs normal links in Windows high-contrast mode (Mohammad Areeb) * Avoid issues where trailing whitespace could be accidentally removed in translations for new page & snippet headers (Florian Vogt) * Make sure minimap error indicators follow the minimap scrolling (Thibaud Colas) + * Remove the ability to view or add comments to `InlinePanel` inner fields to avoid lost or incorrectly linked comments (Jacob Topp-Mugglestone) ### Documentation @@ -68,3 +69,11 @@ depth: 1 The `AbstractImage` and `AbstractRendition` models use a Wagtail-specific `WagtailImageField` which extends Django's `ImageField` to use [Willow](https://github.com/wagtail/Willow/) for image file handling. This will generate a new migration if you are using a [custom image model](custom_image_model) + +### Comments within `InlinePanel` not supported + +When the commenting system was introduced, support for `InlinePanel` fields was incorrectly added. This has lead to issues +where comments can be lost on save or in most cases will be added to the incorrect item within the `InlinePanel`. The ability +to add comments here has now been removed and as such any existing comments that were added will no longer show. + +See https://github.com/wagtail/wagtail/issues/9685 for tracking of adding this back officially in the future. diff --git a/wagtail/admin/templates/wagtailadmin/shared/field.html b/wagtail/admin/templates/wagtailadmin/shared/field.html index 591c18f7b2..91458621e3 100644 --- a/wagtail/admin/templates/wagtailadmin/shared/field.html +++ b/wagtail/admin/templates/wagtailadmin/shared/field.html @@ -66,7 +66,7 @@ {% endblock %} {% if show_add_comment_button %} -