Unverified Commit c92b0337 authored by alexpott's avatar alexpott

Revert "Issue #2977276 by Sam152, ergonlogic, amateescu, jibran,...

Revert "Issue #2977276 by Sam152, ergonlogic, amateescu, jibran, greggmarshall: Node views integration that joins revisions to the default entity fails to consider langcode, resulting in duplicate rows"

This reverts commit 75a159c0.
parent 0a3f9f1a
......@@ -27,10 +27,3 @@ function node_post_update_configure_status_field_widget() {
])->save();
}
}
/**
* Clear caches due to updated views data.
*/
function node_post_update_node_revision_views_data() {
// Empty post-update hook.
}
......@@ -216,10 +216,6 @@ public function getViewsData() {
$data['node_field_revision']['nid']['relationship']['base field'] = 'nid';
$data['node_field_revision']['nid']['relationship']['title'] = $this->t('Content');
$data['node_field_revision']['nid']['relationship']['label'] = $this->t('Get the actual content from a content revision.');
$data['node_field_revision']['nid']['relationship']['extra'][] = [
'field' => 'langcode',
'left_field' => 'langcode',
];
$data['node_field_revision']['vid'] = [
'argument' => [
......@@ -232,12 +228,6 @@ public function getViewsData() {
'base field' => 'vid',
'title' => $this->t('Content'),
'label' => $this->t('Get the actual content from a content revision.'),
'extra' => [
[
'field' => 'langcode',
'left_field' => 'langcode',
],
],
],
] + $data['node_field_revision']['vid'];
......
......@@ -44,13 +44,6 @@ display:
plugin_id: field
entity_type: node
entity_field: nid
langcode:
id: langcode
table: node_field_revision
field: langcode
plugin_id: field
entity_type: node
entity_field: langcode
arguments:
nid:
id: nid
......
......@@ -44,13 +44,6 @@ display:
plugin_id: field
entity_type: node
entity_field: nid
langcode:
id: langcode
table: node_field_revision
field: langcode
entity_type: node
entity_field: langcode
plugin_id: field
arguments:
nid:
id: nid
......
......@@ -2,7 +2,6 @@
namespace Drupal\Tests\node\Kernel\Views;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\node\Entity\Node;
use Drupal\node\Entity\NodeType;
use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
......@@ -21,12 +20,7 @@ class RevisionRelationshipsTest extends ViewsKernelTestBase {
*
* @var array
*/
public static $modules = [
'node',
'node_test_views',
'language',
'content_translation',
];
public static $modules = ['node' , 'node_test_views'];
/**
* {@inheritdoc}
......@@ -39,8 +33,6 @@ protected function setUp($import_test_views = TRUE) {
$this->installEntitySchema('user');
$this->installEntitySchema('node');
ConfigurableLanguage::createFromLangcode('fr')->save();
ViewTestData::createTestViews(get_class($this), ['node_test_views']);
}
......@@ -59,22 +51,16 @@ public function testNodeRevisionRelationship() {
$type->save();
$node = Node::create(['type' => 'page', 'title' => 'test', 'uid' => 1]);
$node->save();
// Add a translation.
$translation = $node->addTranslation('fr', $node->toArray());
$translation->save();
// Create revision of the node.
$node->setNewRevision(TRUE);
$node->save();
$column_map = [
'vid' => 'vid',
'node_field_data_node_field_revision_nid' => 'node_node_revision_nid',
'nid_1' => 'nid_1',
'node_field_revision_langcode' => 'node_field_revision_langcode',
];
// Here should be two rows for each translation.
// Here should be two rows.
$view_nid = Views::getView('test_node_revision_nid');
$this->executeView($view_nid, [$node->id()]);
$resultset_nid = [
......@@ -82,32 +68,17 @@ public function testNodeRevisionRelationship() {
'vid' => '1',
'node_node_revision_nid' => '1',
'nid_1' => '1',
'node_field_revision_langcode' => 'fr',
],
[
'vid' => '1',
'node_node_revision_nid' => '1',
'nid_1' => '1',
'node_field_revision_langcode' => 'en',
],
[
'vid' => '2',
'node_revision_nid' => '1',
'node_node_revision_nid' => '1',
'nid_1' => '1',
'node_field_revision_langcode' => 'fr',
],
[
'vid' => '2',
'node_revision_nid' => '1',
'node_node_revision_nid' => '1',
'nid_1' => '1',
'node_field_revision_langcode' => 'en',
],
];
$this->assertIdenticalResultset($view_nid, $resultset_nid, $column_map);
// There should be one row with active revision 2 for each translation.
// There should be only one row with active revision 2.
$view_vid = Views::getView('test_node_revision_vid');
$this->executeView($view_vid, [$node->id()]);
$resultset_vid = [
......@@ -115,13 +86,6 @@ public function testNodeRevisionRelationship() {
'vid' => '2',
'node_node_revision_nid' => '1',
'nid_1' => '1',
'node_field_revision_langcode' => 'en',
],
[
'vid' => '2',
'node_node_revision_nid' => '1',
'nid_1' => '1',
'node_field_revision_langcode' => 'fr',
],
];
$this->assertIdenticalResultset($view_vid, $resultset_vid, $column_map);
......
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