diff -u b/core/modules/tracker/src/Controller/TrackerController.php b/core/modules/tracker/src/Controller/TrackerController.php --- b/core/modules/tracker/src/Controller/TrackerController.php +++ b/core/modules/tracker/src/Controller/TrackerController.php @@ -227,9 +227,9 @@ if ($comment_installed) { $comment_row = [ 'comments' => [ - 'class' => ['comments'], - 'data' => $tracker_data[$node->id()]->comment_count ?? 0, - 'data-history-node-last-comment-timestamp' => $tracker_data[$node->id()]->last_comment_timestamp ?? 0, + 'class' => ['comments'], + 'data' => $tracker_data[$node->id()]->comment_count ?? 0, + 'data-history-node-last-comment-timestamp' => $tracker_data[$node->id()]->last_comment_timestamp ?? 0, ], ]; $row = array_slice($row, 0, 3) + $comment_row + array_slice($row, 3); diff -u b/core/modules/tracker/tests/src/Functional/TrackerTest.php b/core/modules/tracker/tests/src/Functional/TrackerTest.php --- b/core/modules/tracker/tests/src/Functional/TrackerTest.php +++ b/core/modules/tracker/tests/src/Functional/TrackerTest.php @@ -67,9 +67,6 @@ $this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page']); $permissions = ['access comments', 'create page content', 'post comments', 'skip comment approval']; - $this->user = $this->drupalCreateUser($permissions); - $this->otherUser = $this->drupalCreateUser($permissions); - $this->addDefaultCommentField('node', 'page'); $this->user = $this->drupalCreateUser($this->permissions); $this->otherUser = $this->drupalCreateUser($this->permissions); user_role_grant_permissions(AccountInterface::ANONYMOUS_ROLE, [ @@ -103,13 +100,13 @@ // Assert cache contexts, specifically the pager and node access contexts. $this->assertCacheContexts(['languages:language_interface', 'route', 'theme', 'url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT, 'url.query_args.pagers:0', 'user.node_grants:view', 'user']); $this->assertCacheContexts([ - 'languages:language_interface', - 'route', 'theme', - 'url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT, - 'url.query_args.pagers:0', - 'user.node_grants:view', - 'user', - ] + 'languages:language_interface', + 'route', 'theme', + 'url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT, + 'url.query_args.pagers:0', + 'user.node_grants:view', + 'user', + ] ); // Assert cache tags for the action/tabs blocks, visible node, and node list // cache tag. @@ -156,21 +153,22 @@ 'title' => $this->randomMachineName(8), 'uid' => $this->user->id(), 'status' => 1, - ]); + ]); $this->drupalGet('user/' . $this->user->id() . '/activity'); // Assert cache contexts. $this->assertCacheContexts([ - 'languages:language_interface', - 'route', 'theme', - 'url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT, - 'url.query_args.pagers:0', - 'user', - 'user.node_grants:view', - ] + 'languages:language_interface', + 'route', 'theme', + 'url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT, + 'url.query_args.pagers:0', + 'user', + 'user.node_grants:view', + ] ); // Assert cache tags for the visible nodes (including owners) and node list // cache tag. - $expected_tags = Cache::mergeTags($nodes['my_published']->getCacheTags(), $nodes['my_published']->getOwner()->getCacheTags());// Because the 'user.permissions' cache context is being optimized away. + // Because the 'user.permissions' cache context is being optimized away. + $expected_tags = Cache::mergeTags($nodes['my_published']->getCacheTags(), $nodes['my_published']->getOwner()->getCacheTags()); $role_tags = []; foreach ($this->user->getRoles() as $rid) { $role_tags[] = "config:user.role.$rid"; @@ -192,19 +190,19 @@ $this->assertCacheTags($expected_tags); $this->assertCacheContexts([ - 'languages:language_interface', - 'route', - 'theme', - 'url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT, - 'url.query_args.pagers:0', - 'user', - 'user.node_grants:view', - ] + 'languages:language_interface', + 'route', + 'theme', + 'url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT, + 'url.query_args.pagers:0', + 'user', + 'user.node_grants:view', + ] ); - - $this->assertSession()->linkExists($nodes['my_published']->label()); - $this->assertSession()->linkNotExists($nodes['unpublished']->label()); - + + $this->assertSession()->linkExists($nodes['my_published']->label()); + $this->assertSession()->linkNotExists($nodes['unpublished']->label()); + // Test escaping of title on user's tracker tab. \Drupal::service('module_installer')->install(['user_hooks_test']); Cache::invalidateTags(['rendered']); @@ -278,7 +276,7 @@ * @param \Drupal\node\Entity\Node[] $nodes * The created nodes to test. */ - protected function doTestTrackerCronIndexing(array $nodes) { + protected function doTestTrackerCronIndexing(array $nodes) { // Start indexing backwards from node 4. \Drupal::state()->set('tracker.index_nid', 4); @@ -353,7 +351,7 @@ * We do this in JavaScript to prevent breaking the render cache. * * @param int $node_id - * A node ID, that must exist as a data-history-node-id attribute + * A node ID, that must exist as a data-history-node-id attribute. * @param int $node_timestamp * A node timestamp, that must exist as a data-history-node-timestamp * attribute.