Commit 8dc87c91 authored by webchick's avatar webchick

Issue #2744877 by katzilla, dernetzjaeger, biancajs, chipway, Gábor Hojtsy,...

Issue #2744877 by katzilla, dernetzjaeger, biancajs, chipway, Gábor Hojtsy, catch, romainj, lucur, yoroy, kamalrajsahu21, dietmarg: Node add form shows 'create new revision' checkbox
parent 4f917488
......@@ -139,7 +139,7 @@ public function form(array $form, FormStateInterface $form_state) {
'#type' => 'checkbox',
'#title' => t('Create new revision'),
'#default_value' => $node->type->entity->isNewRevision(),
'#access' => $current_user->hasPermission('administer nodes'),
'#access' => $current_user->hasPermission('administer nodes') && !$node->isNew(),
'#group' => 'revision_information',
);
......
......@@ -72,6 +72,12 @@ function testNodeCreation() {
$this->drupalGet('node/' . $node->id());
$this->assertText($node->getOwner()->getUsername());
$this->assertText(format_date($node->getCreatedTime()));
// Check if the node revision checkbox is not rendered on node creation form.
$admin_user = $this->drupalCreateUser(array('administer nodes', 'create page content'));
$this->drupalLogin($admin_user);
$this->drupalGet('node/add/page');
$this->assertNoFieldById('edit-revision', NULL , 'The revision checkbox is not present.');
}
/**
......
......@@ -111,6 +111,10 @@ public function testNodeEdit() {
$first_node_version = node_revision_load($node->getRevisionId());
$second_node_version = node_revision_load($revised_node->getRevisionId());
$this->assertNotIdentical($first_node_version->getRevisionUser()->id(), $second_node_version->getRevisionUser()->id(), 'Each revision has a distinct user.');
// Check if the node revision checkbox is rendered on node edit form.
$this->drupalGet('node/' . $node->id() . '/edit');
$this->assertFieldById('edit-revision', NULL, 'The revision field is present.');
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment