Commit 061c799d authored by Sebastian Michaelsen's avatar Sebastian Michaelsen Committed by Benni Mack
Browse files

[BUGFIX] Respect query settings for version overlay enable fields

Resolves: #93027
Releases: main, 11.5
Change-Id: I65b4b84a12cf4985d14a62217b075e5c421e0ee6
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72780


Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent e1c5366c
......@@ -523,7 +523,7 @@ class Typo3DbBackend implements BackendInterface, SingletonInterface
);
}
// Handle workspace overlays
$pageRepository->versionOL($tableName, $row, true);
$pageRepository->versionOL($tableName, $row, true, $querySettings->getIgnoreEnableFields());
if (is_array($row) && $querySettings->getLanguageOverlayMode()) {
if ($tableName === 'pages') {
$row = $pageRepository->getPageOverlay($row, $querySettings->getLanguageUid());
......
......@@ -96,4 +96,32 @@
<t3ver_state>0</t3ver_state>
<t3ver_wsid>1</t3ver_wsid>
</tx_blogexample_domain_model_blog>
<tx_blogexample_domain_model_blog>
<uid>103</uid>
<pid>0</pid>
<title>WorkspaceOverlay Blog2HiddenInWorkspace</title>
<description>WorkspaceOverlay Blog2HiddenInWorkspace Description</description>
<logo></logo>
<l18n_diffsource></l18n_diffsource>
<hidden>1</hidden>
<deleted>0</deleted>
<posts>1</posts>
<t3ver_oid>2</t3ver_oid>
<t3ver_state>0</t3ver_state>
<t3ver_wsid>1</t3ver_wsid>
</tx_blogexample_domain_model_blog>
<tx_blogexample_domain_model_blog>
<uid>104</uid>
<pid>0</pid>
<title>WorkspaceOverlay Blog4HiddenInLiveAndWorkspace</title>
<description>WorkspaceOverlay Blog4HiddenInLiveAndWorkspace Description</description>
<logo></logo>
<l18n_diffsource></l18n_diffsource>
<hidden>1</hidden>
<deleted>0</deleted>
<posts>1</posts>
<t3ver_oid>4</t3ver_oid>
<t3ver_state>0</t3ver_state>
<t3ver_wsid>1</t3ver_wsid>
</tx_blogexample_domain_model_blog>
</dataset>
......@@ -97,6 +97,56 @@ class WorkspaceTest extends FunctionalTestCase
self::assertSame(5, $query->execute()->count());
}
/**
* @test
* @dataProvider contextDataProvider
* @param string $context
*/
public function fetchingHiddenBlogInWorkspace(string $context): void
{
// Set up Context for Workspace=1
if ($context === 'FE') {
$this->setupSubjectInFrontend();
} else {
$this->setupSubjectInBackend();
}
$query = $this->blogRepository->createQuery();
$querySettings = $query->getQuerySettings();
$querySettings->setStoragePageIds([0]);
$query->matching(
$query->logicalOr(
$query->like('title', '%Blog2%'),
$query->like('title', '%Blog4%'),
$query->like('title', '%Blog6%')
)
);
$query->setOrderings(['title' => QueryInterface::ORDER_ASCENDING]);
// Respect hidden flags, only show the item that was hidden in live, but is now visible in workspace
$querySettings->setIgnoreEnableFields(false);
$items = $query->execute();
$foundItems = [];
foreach ($items as $item) {
$foundItems[] = $item->getTitle();
}
self::assertEquals(['WorkspaceOverlay Blog6Enabled'], $foundItems);
// Allow hidden records to show up (resulting in 3 blog items)
$querySettings->setIgnoreEnableFields(true);
$items = $query->execute();
$foundItems = [];
foreach ($items as $item) {
$foundItems[] = $item->getTitle();
}
self::assertEquals([
'WorkspaceOverlay Blog2HiddenInWorkspace',
'WorkspaceOverlay Blog4HiddenInLiveAndWorkspace',
'WorkspaceOverlay Blog6Enabled',
], $foundItems);
}
/**
* @test
* @dataProvider contextDataProvider
......@@ -119,7 +169,7 @@ class WorkspaceTest extends FunctionalTestCase
$blogs = $query->execute()->toArray();
self::assertCount(4, $blogs);
self::assertCount(3, $blogs);
// Check first blog was overlaid with workspace preview
$firstBlog = array_shift($blogs);
......
Supports Markdown
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