Provide methods for getting number of comments

Created on 21 November 2024, 5 months ago

Problem/Motivation

We have a need to present information to users about:

  • Number of unresolved comments, resolved comments and total comments per node (including comments added on paragraphs)
  • A list of content where the user is tagged in comments, where those comments are unresolved.

Doing this is possible using entity queries, but those queries are not simple, due to the nature of how comments are stored.

For example, adding this condition to an entity query to get the number of unresolved comments condition('attributes', '"resolved_at": null', 'CONTAINS').

While it's quite possible to do this in custom code, it starts to touch on the internals of how comments are stored, and any change to that risks breaking these queries, so it feels like something which would be better handled by methods on either the Comment storage class, or in a dedicated service class.

It would also be useful if these methods could look for any entity_reference_revision fields on the entity, and if any are found, use those entity IDs in an entity query as well. This would also factor in paragraphs, where returning a comment count for a given node would then also include any comments on the paragraphs in that node.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Active

Version

1.3

Component

Plugin: Collaboration

Created by

🇬🇧United Kingdom AaronMcHale Edinburgh, Scotland

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

Comments & Activities

Production build 0.71.5 2024