Creating a comment from a field in a view takes me to the admin edit page for that entity.

Created on 5 August 2024, 11 months ago

Problem/Motivation

As per: https://www.drupal.org/project/ajax_comments/issues/3419586#comment-1570... πŸ› Customizations for comment delete form interfere with Core's delete modal in the admin UI Needs review

It'd be nice to be able to have comments associated with a data focused entity (using the storage contrib module) in a view. There is no direct view page for the entity, it just gets used in views.

I would expect for the comment to just show up on the page using Ajax. Applying further patches stopped the redirect to the edit page, but the page still required a manual refresh for comments to show up.

Steps to reproduce

If I add a comment field to the entity, and then add that field to the view I get the traditional interface - add a comment, view existing comments, etc. If I add a comment, this takes me to the edit page in the admin interface for that entity. ala /storage/1234/edit/

Thoughts

This may be related to this module not working outside of default view modes as per "Ajax not working when using non-default view mode" https://www.drupal.org/project/ajax_comments/issues/2896916 πŸ› Ajax not working when using non-default view mode. Needs work

πŸ› Bug report
Status

Active

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States erutan

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

Comments & Activities

  • Issue created by @erutan
  • It seems like you're having trouble with comments not showing up in views without a manual refresh. This might be related to the storage contrib module My Results ATT not working well with non-default view modes. To fix this, ensure your modules are up-to-date, consider writing custom code to handle AJAX functionality, look into alternative modules that better support comments in views, or seek advice from the Drupal community for a more tailored solution.

  • The issue likely flying together stems from a lack of AJAX integration within Storage Contrib for dynamic comment updates within views. Consider leveraging existing Drupal comment systems, developing a custom AJAX implementation, or exploring community modules.

  • The AJAX Comments module is struggling with non-default view modes, requiring a manual refresh for comments to appear. The issue might stem from how the module handles entity storage and dynamic updates within views. A similar problem has been reported regarding AJAX not functioning properly when using non-default view modes. Applying patches has helped mitigate some issues, but the redirect to the edit page suggests that AJAX isn't fully handling inline comment updates e-zpassmd Have you tried debugging the AJAX response or checking if any caching settings interfere with real-time updates?

  • You've correctly pinpointed the problem: getting AJAX comments to work seamlessly on custom data entities displayed only within Views, without redirects or manual refreshes, is tricky because Drupal's comment module expects a dedicated entity "view page." To fix this, the best approach is to define a canonical route for your custom entity in its annotation, even if you don't use it directly. This provides the necessary context UPSers com for Drupal's core comment AJAX to function properly. If that doesn't fully resolve it, you may need to implement a custom AJAX callback using hook_form_alter to specifically re-render the comments section within your View after submission.

Production build 0.71.5 2024