diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index 0ee6f4c..8ec53d9 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -699,6 +699,7 @@ function template_preprocess_comment(&$variables) { ); $variables['author'] = drupal_render($username); $variables['author_id'] = $comment->getOwnerId(); + $variables['author_anonymous'] = $comment->getOwner()->isAnonymous(); $variables['new_indicator_timestamp'] = $comment->getChangedTime(); $variables['created'] = format_date($comment->getCreatedTime()); // Avoid calling format_date() twice on the same timestamp. diff --git a/core/modules/comment/templates/comment.html.twig b/core/modules/comment/templates/comment.html.twig index 24dbd07..1da2a3b 100644 --- a/core/modules/comment/templates/comment.html.twig +++ b/core/modules/comment/templates/comment.html.twig @@ -70,7 +70,7 @@ set classes = [ 'comment', status != 'published' ? status, - not author_id ? 'by-anonymous', + author_anonymous ? 'by-anonymous', author_id and author_id == commented_entity.getOwnerId() ? 'by-' ~ commented_entity.getEntityTypeId() ~ '-author', 'clearfix', ] diff --git a/core/themes/bartik/templates/comment.html.twig b/core/themes/bartik/templates/comment.html.twig index 0fa1991..92e7a82 100644 --- a/core/themes/bartik/templates/comment.html.twig +++ b/core/themes/bartik/templates/comment.html.twig @@ -68,7 +68,7 @@ set classes = [ 'comment', status != 'published' ? status, - not author_id ? 'by-anonymous', + author_anonymous ? 'by-anonymous', author_id and author_id == commented_entity.getOwnerId() ? 'by-' ~ commented_entity.getEntityTypeId() ~ '-author', 'clearfix', ]