.../comment/lib/Drupal/comment/CommentRenderController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/modules/comment/lib/Drupal/comment/CommentRenderController.php b/core/modules/comment/lib/Drupal/comment/CommentRenderController.php index 0ccfba9..93fd358 100644 --- a/core/modules/comment/lib/Drupal/comment/CommentRenderController.php +++ b/core/modules/comment/lib/Drupal/comment/CommentRenderController.php @@ -163,7 +163,7 @@ protected function buildLinks(CommentInterface $entity, EntityInterface $comment ); } - if (user_access('edit own comments') || user_access('administer comments')) { + if ($entity->status->value == COMMENT_PUBLISHED && \Drupal::currentUser()->hasPermission('edit own comments') || \Drupal::currentUser()->hasPermission('administer comments')) { $links['comment-edit'] = array( 'title' => t('edit'), 'href' => "comment/{$entity->id()}/edit", @@ -174,7 +174,7 @@ protected function buildLinks(CommentInterface $entity, EntityInterface $comment // "edit" link by default to not break the render cache. We then use // JavaScript to only show the "edit" link on comments where the // comment author is the same user as the currently active user. - if (!user_access('administer comments')) { + if (!\Drupal::currentUser()->hasPermission('administer comments')) { $links['comment-edit']['attributes'] = array( 'class' => 'hidden', 'data-comment-link-edit-own' => TRUE, @@ -188,7 +188,7 @@ protected function buildLinks(CommentInterface $entity, EntityInterface $comment 'type' => 'setting', 'data' => array( 'comment' => array( - 'canEditOwnComments' => user_access('edit own comments'), + 'canEditOwnComments' => \Drupal::currentUser()->hasPermission('edit own comments'), ), ), ),