Customizations for comment delete form interfere with Core's delete modal in the admin UI

Created on 6 February 2024, 11 months ago
Updated 12 August 2024, 4 months ago

Problem/Motivation

In Drupal 10.1 a modal form for delete action in admin UI has been introduced (see πŸ“Œ Use a modal for entity delete operation links Fixed ). Basically, now the delete action in admin UI is handled by Ajax request.
The Ajax comments module alters the delete comment form for Ajax requests for handling action links on the Ajax comment form. It relies on attributes added by the JS code of the Ajax comments module but for admin UI it is not the case, and some logic gets broken.

Because of this, the comment delete action is stuck on an unexpected Ajax response and the page is not reloading as it should after a successful action.

Example of log messages:

Deprecated function: substr(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\ajax_comments\TempStore->getSelectorValue() (line 67 of /web/modules/contrib/ajax_comments/src/TempStore.php)

Deprecated function: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in Drupal\ajax_comments\TempStore->getSelectorValue() (line 67 of /web/modules/contrib/ajax_comments/src/TempStore.php)

Steps to reproduce

  1. Drupal 10.2, Ajax comments 8.x-1.x-dev
  2. Go to Manage > Content > Comments
  3. Choose some comment, expand operations link dropdown > Delete > Delete

Expected behaviour
The comment is deleted and has gone from the list.

Actual behavior
Nothing seems changed. However, the comment is actually deleted but the page is not refreshed.

Proposed resolution

Add a few guard clauses to prevent the execution of unintended code parts.

Remaining tasks

No.

User interface changes

No.

API changes

No.

Data model changes

No.

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡¬πŸ‡ͺGeorgia iamdroid

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024