diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index fc840d0..f9a7cb1 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -1085,7 +1085,7 @@ function comment_entity_insert(EntityInterface $entity) { 'last_comment_timestamp' => isset($entity->changed) ? $entity->changed : REQUEST_TIME, 'last_comment_name' => NULL, // Default to current user when entity does not have a uid property. - 'last_comment_uid' => isset($entity->uid) ? $entity->uid : $user->uid, + 'last_comment_uid' => isset($entity->uid) ? $entity->uid : $user->id(), 'comment_count' => 0, )); } @@ -1862,7 +1862,7 @@ function comment_mark(CommentInterface $comment) { $cache = &drupal_static(__FUNCTION__, array()); $cid = $comment->entity_id->value . '__' . $comment->entity_type->value; - if (!$user->uid) { + if (!$user->isAuthenticated()) { return MARK_READ; } if (!isset($cache[$cid])) { diff --git a/core/modules/comment/lib/Drupal/comment/CommentStorageController.php b/core/modules/comment/lib/Drupal/comment/CommentStorageController.php index 9b99f62..e1c5250 100644 --- a/core/modules/comment/lib/Drupal/comment/CommentStorageController.php +++ b/core/modules/comment/lib/Drupal/comment/CommentStorageController.php @@ -106,7 +106,7 @@ public function updateEntityStatistics(CommentInterface $comment) { // @todo Refactor when http://drupal.org/node/585838 lands. // Get the user ID from the entity if it's set, or default to the // currently logged in user. - 'last_comment_uid' => isset($entity->uid->target_id) ? $entity->uid->target_id : $user->uid, + 'last_comment_uid' => isset($entity->uid->target_id) ? $entity->uid->target_id : $user->id(), )) ->condition('entity_id', $comment->entity_id->value) ->condition('entity_type', $comment->entity_type->value) diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentUserTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentUserTest.php index 3a3d599..dba5f62 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentUserTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentUserTest.php @@ -337,7 +337,7 @@ function testCommentUser() { $this->assertFieldByName('subject', '', 'Subject field found.'); $this->assertFieldByName("comment_body[$langcode][0][value]", '', 'Comment field found.'); - $this->drupalGet('comment/reply/user/' . $this->web_user->uid . '/comment/' . $comment1->id()); + $this->drupalGet('comment/reply/user/' . $this->web_user->id() . '/comment/' . $comment1->id()); $this->assertText('You are not authorized to view comments'); $this->assertNoText($comment1->subject->value, 'Comment not displayed.'); } diff --git a/core/modules/comment/lib/Drupal/comment/Tests/Views/CommentTestBase.php b/core/modules/comment/lib/Drupal/comment/Tests/Views/CommentTestBase.php index 143e0bc..871446e 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/Views/CommentTestBase.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/Views/CommentTestBase.php @@ -43,7 +43,7 @@ function setUp() { comment_add_default_comment_field('node', 'page'); $this->node_user_posted = $this->drupalCreateNode(); - $this->node_user_commented = $this->drupalCreateNode(array('uid' => $this->account2->uid)); + $this->node_user_commented = $this->drupalCreateNode(array('uid' => $this->account2->id())); $comment = array( 'uid' => $this->loggedInUser->id(),