Skip to content

Commit

Permalink
Merge tag v2.2.12 into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
roadiz-ci committed Mar 8, 2024
1 parent 6ae7645 commit 937d8b6
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 17 deletions.
2 changes: 0 additions & 2 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ services:
$cmsVersion: '%roadiz_core.cms_version%'
$appVersion: '%roadiz_core.app_version%'
$cmsVersionPrefix: '%roadiz_core.cms_version_prefix%'
$staticDomain: '%roadiz_core.static_domain_name%'
$hideRoadizVersion: '%roadiz_core.hide_roadiz_version%'
$inheritanceType: '%roadiz_core.inheritance_type%'
$maxPixelSize: '%rz_intervention_request.max_pixel_size%'
Expand Down Expand Up @@ -544,7 +543,6 @@ services:
alias: RZ\Roadiz\CoreBundle\Filesystem\RoadizFileDirectories
public: true

RZ\Roadiz\Documents\Packages: ~
RZ\Roadiz\Documents\DownscaleImageManager: ~
RZ\Roadiz\Documents\DocumentArchiver: ~
#
Expand Down
5 changes: 4 additions & 1 deletion src/Entity/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,10 @@ public function hasThumbnails(): bool
*/
public function getThumbnails(): Collection
{
return $this->thumbnails;
// Filter private thumbnails
return $this->thumbnails->filter(function (DocumentInterface $thumbnail) {
return !$thumbnail->isPrivate();
});
}

public function setThumbnails(Collection $thumbnails): static
Expand Down
2 changes: 1 addition & 1 deletion src/Logger/DoctrineHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function __construct(

protected function getThumbnailSourcePath(?DocumentInterface $thumbnail): ?string
{
if (null === $thumbnail) {
if (null === $thumbnail || $thumbnail->isPrivate()) {
return null;
}
return $this->documentUrlGenerator
Expand Down
12 changes: 1 addition & 11 deletions src/Routing/DocumentUrlGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,13 @@

final class DocumentUrlGenerator extends AbstractDocumentUrlGenerator
{
private UrlGeneratorInterface $urlGenerator;

/**
* @param FilesystemOperator $documentsStorage
* @param UrlHelper $urlHelper
* @param UrlGeneratorInterface $urlGenerator
* @param CacheItemPoolInterface $optionsCacheAdapter
* @throws InvalidArgumentException
*/
public function __construct(
FilesystemOperator $documentsStorage,
UrlHelper $urlHelper,
UrlGeneratorInterface $urlGenerator,
private readonly UrlGeneratorInterface $urlGenerator,
CacheItemPoolInterface $optionsCacheAdapter
) {
parent::__construct($documentsStorage, $urlHelper, $optionsCacheAdapter);
$this->urlGenerator = $urlGenerator;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/TwigExtension/DocumentUrlExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace RZ\Roadiz\CoreBundle\TwigExtension;

use RZ\Roadiz\Core\AbstractEntities\PersistableInterface;
use RZ\Roadiz\CoreBundle\Entity\Document;
use RZ\Roadiz\Documents\Models\DocumentInterface;
use RZ\Roadiz\Documents\UrlGenerators\DocumentUrlGeneratorInterface;
use Symfony\Component\OptionsResolver\Exception\InvalidArgumentException;
use Twig\Error\RuntimeError;
Expand Down Expand Up @@ -55,7 +55,7 @@ public function getUrl(PersistableInterface $mixed = null, array $criteria = [])
}
}

if ($mixed instanceof Document) {
if ($mixed instanceof DocumentInterface) {
try {
$absolute = false;
if (isset($criteria['absolute'])) {
Expand Down

0 comments on commit 937d8b6

Please sign in to comment.