diff --git a/core/modules/node/src/Controller/NodeController.php b/core/modules/node/src/Controller/NodeController.php index 336738f..a2145a1 100644 --- a/core/modules/node/src/Controller/NodeController.php +++ b/core/modules/node/src/Controller/NodeController.php @@ -165,7 +165,7 @@ public function revisionOverview(NodeInterface $node) { $header = array($this->t('Revision'), $this->t('Operations')); $revert_permission = (($account->hasPermission("revert $type revisions") || $account->hasPermission('revert all revisions') || $account->hasPermission('administer nodes')) && $node->access('update')); - $delete_permission = (($account->hasPermission("delete $type revisions") || $account->hasPermission('delete all revisions') || $account->hasPermission('administer nodes')) && $node->access('delete')); + $delete_permission = (($account->hasPermission("delete $type revisions") || $account->hasPermission('delete all revisions') || $account->hasPermission('administer nodes')) && $node->access('delete')) $rows = array(); @@ -178,7 +178,7 @@ public function revisionOverview(NodeInterface $node) { '#account' => $revision->uid->entity, ]; - // Link to old version if not viewing current revision. + // Use revision link to link to revisions that are not active. $date = $this->dateFormatter->format($revision->revision_timestamp->value, 'short'); if ($vid != $node->getRevisionId()) { $link = $this->l($date, new Url('entity.node.revision', ['node' => $node->id(), 'node_revision' => $vid])); diff --git a/core/modules/node/src/Tests/NodeRevisionsUiTest.php b/core/modules/node/src/Tests/NodeRevisionsUiTest.php index df33936..635aebe 100644 --- a/core/modules/node/src/Tests/NodeRevisionsUiTest.php +++ b/core/modules/node/src/Tests/NodeRevisionsUiTest.php @@ -7,7 +7,6 @@ namespace Drupal\node\Tests; -use Drupal\Component\Utility\SafeMarkup; use Drupal\Core\Url; use Drupal\node\Entity\Node; use Drupal\node\Entity\NodeType; @@ -22,12 +21,7 @@ class NodeRevisionsUiTest extends NodeTestBase { /** * @var \Drupal\user\Entity\User */ - protected $webUser1; - - /** - * @var \Drupal\user\Entity\User - */ - protected $webUser2; + protected $editor; /** * {@inheritdoc} @@ -36,13 +30,9 @@ protected function setUp() { parent::setUp(); // Create users. - $this->webUser1 = $this->drupalCreateUser([ + $this->editor = $this->drupalCreateUser([ 'administer nodes', 'edit any page content' - ]); - $this->webUser2 = $this->drupalCreateUser([ - 'administer nodes', - 'edit any page content', 'view page revisions', 'access user profiles', ]); @@ -52,7 +42,7 @@ protected function setUp() { * Checks that unchecking 'Create new revision' works when editing a node. */ function testNodeFormSaveWithoutRevision() { - $this->drupalLogin($this->webUser1); + $this->drupalLogin($this->editor); $node_storage = $this->container->get('entity.manager')->getStorage('node'); // Set page revision setting 'create new revision'. This will mean new @@ -94,8 +84,8 @@ function testNodeFormSaveWithoutRevision() { /** * Checks HTML double escaping of revision logs. */ - function testNodeRevisionDoubleEscapeFix() { - $this->drupalLogin($this->webUser2); + public function testNodeRevisionDoubleEscapeFix() { + $this->drupalLogin($this->editor); $nodes = []; // Create the node. @@ -103,9 +93,9 @@ function testNodeRevisionDoubleEscapeFix() { $username = [ '#theme' => 'username', - '#account' => $this->webUser2, + '#account' => $this->editor, ]; - $web_user = \Drupal::service('renderer')->render($username); + $editor = \Drupal::service('renderer')->render($username); // Get original node. $nodes[] = clone $node; @@ -130,7 +120,7 @@ function testNodeRevisionDoubleEscapeFix() { $url = new Url('entity.node.revision', ['node' => $nodes[0]->id(), 'node_revision' => $nodes[0]->getRevisionId()]); $old_revision_message = t('!date by !username', [ '!date' => \Drupal::l($date, $url), - '!username' => $web_user, + '!username' => $editor, ]); $old_revision_message .= $nodes[0]->revision_log->value == '' ? '' : '
' . $nodes[0]->revision_log->value . '
'; $this->assertRaw($old_revision_message); @@ -139,7 +129,7 @@ function testNodeRevisionDoubleEscapeFix() { $date = format_date($nodes[1]->revision_timestamp->value, 'short'); $current_revision_message = t('!date by !username', [ '!date' => $nodes[1]->link($date), - '!username' => $web_user, + '!username' => $editor, ]); $current_revision_message .= $nodes[1]->revision_log->value == '' ? '' : '' . $nodes[1]->revision_log->value . '
'; $this->assertRaw($current_revision_message);