Quantcast
Viewing all articles
Browse latest Browse all 294949

Impossible to create comments on comments: commented entity considered unreferencable because CommentSelection::entityQueryAlter() joins on {node_field_data} table

After testing the jsonapi I came across this discovery.
I am able to create a comment of a comment (of entity_type "node") of a node. However, I can't go the next level which would be a comment of a comment (entity_type "comment") of a comment of a node.
I can do it from the drupal ui directly. I don't know if this is to protect against circular references or what, but this needs to be looked into.

Steps to reproduce.
Create 2 more comment types.
CommentOfNodeComment
CommentOfCommentComment

Then for Default comments add field General Comments CommentOfNodeComment
Then for CommentOfNodeComment add field General Comments CommentOfCommentComment

Then create an article w/ comments down to CommentOfCommentComment.

Then try to create a CommentOfCommentComment via a rest call. E.g.

POST {{protocol}}://{{host}}/jsonapi/comment/responses HTTP/1.1
Authorization: Basic token
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json

{
  "data": {
    "type": "comment--commentofcommentcomment",
    "attributes": {
      "subject": "test CommentOfCommentComment",
      "entity_type": "comment",
      "field_name": "field_commentofcommentcomment",
      "comment_body": {
          "value": "some text",
          "format": "basic_html"
        },
      "entity_id": [{"target_id": 4}],
      "uid": [{"target_id": 1}]
    }
  }
}

Viewing all articles
Browse latest Browse all 294949

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>