Skip to content

Commit

Permalink
Fixed route provider regarding published state and ghost content (#555)
Browse files Browse the repository at this point in the history
* Fixed route provider regarding published state and ghost content

* Added locale to test

* Replaced tab with spaces

* Fixed test
  • Loading branch information
thomasduenser authored Mar 25, 2021
1 parent 077ea21 commit b79daf0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion Routing/ArticleRouteDefaultProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,13 @@ public function getByEntity($entityClass, $id, $locale, $object = null)
*/
public function isPublished($entityClass, $id, $locale)
{
$object = $this->documentManager->find($id, $locale);
$object = $this->documentManager->find(
$id,
$locale,
[
'load_ghost_content' => false,
]
);

if (!$object instanceof ArticleInterface || WorkflowStage::PUBLISHED !== $object->getWorkflowStage()) {
return false;
Expand Down
8 changes: 7 additions & 1 deletion Tests/Unit/Routing/ArticleRouteDefaultProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,13 @@ public function testIsPublished(
$this->webspaceResolver->resolveAdditionalWebspaces($document)->willReturn($documentAdditionalWebspaces);
}

$this->documentManager->find($this->entityId, $this->locale)->willReturn($document);
$this->documentManager->find(
$this->entityId,
$this->locale,
[
'load_ghost_content' => false,
]
)->willReturn($document);

$webspace = $this->prophesize(Webspace::class);
$webspace->getKey()->willReturn($webspaceKey);
Expand Down

0 comments on commit b79daf0

Please sign in to comment.