Repeatable:
Always

Steps to repeat:

1. configure a content type with comment open
2. create a new node of previous defined type via code or devel generate

To create a node via code:

  $edit_node = array(
    'nid' => NULL,
    'type' => 'article',
    'title' => 'Prova',
    'uid' => 1,
    'revision' => 1,
    'status' => TRUE,
    'promote' => 0,
    'created' => REQUEST_TIME,
    'langcode' => LANGUAGE_NOT_SPECIFIED,
  );

  $node = entity_create('node', $edit_node);
  $node->save();

Expected Results:
Comment for node is open.
$node->comment = COMMENT_NODE_OPEN;

Actual Results:
Comment status property is missing.
$node->comment = undefined;

Comments

mavimo’s picture

StatusFileSize
new559 bytes

To solve this issue we need to change hook_node_prepare to hook_node_create.

Patch worked with @peximo during drupal code sprint.

mavimo’s picture

Status: Active » Needs review
plach’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

Looks sensible to me. We need tests for this.

peximo’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
StatusFileSize
new1.72 KB

Added tests.

Status: Needs review » Needs work

The last submitted patch, 4: comment-node_creation-1938084-4.patch, failed testing.

larowlan’s picture

Issue summary: View changes
Status: Needs work » Closed (fixed)

Comments no longer tied to nodes