From e05182222564e2a4dd59048cbac5d7771fc99d82 Mon Sep 17 00:00:00 2001 From: Ambroise Maupate Date: Thu, 10 Oct 2024 18:41:20 +0200 Subject: [PATCH 1/3] fix: Do not throw exception on bad page and itemPerPage argument, just use defaults fix #20 --- .../src/ListManager/AbstractEntityListManager.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/RoadizCoreBundle/src/ListManager/AbstractEntityListManager.php b/lib/RoadizCoreBundle/src/ListManager/AbstractEntityListManager.php index 128c964c..2282d0b3 100644 --- a/lib/RoadizCoreBundle/src/ListManager/AbstractEntityListManager.php +++ b/lib/RoadizCoreBundle/src/ListManager/AbstractEntityListManager.php @@ -91,10 +91,7 @@ public function setDisplayingAllNodesStatuses(bool $displayAllNodesStatuses) */ public function setPage(int $page) { - if ($page < 1) { - throw new \RuntimeException("Page cannot be lesser than 1.", 1); - } - $this->currentPage = (int) $page; + $this->currentPage = $page > 0 ? $page : 1; return $this; } @@ -199,11 +196,7 @@ protected function getItemPerPage(): int */ public function setItemPerPage(int $itemPerPage) { - if ($itemPerPage < 1) { - throw new \RuntimeException("Item count per page cannot be lesser than 1.", 1); - } - - $this->itemPerPage = (int) $itemPerPage; + $this->itemPerPage = $itemPerPage > 0 ? $itemPerPage : 1; return $this; } From e61e2ee7f6caf12275a86519085e50d41917003b Mon Sep 17 00:00:00 2001 From: Ambroise Maupate Date: Thu, 10 Oct 2024 18:53:03 +0200 Subject: [PATCH 2/3] fix: Allow duplicated documents when embedding audio embed covers, fix #19 --- .../src/MediaFinders/AbstractDeezerEmbedFinder.php | 5 +++++ .../src/MediaFinders/AbstractMixcloudEmbedFinder.php | 5 +++++ lib/Documents/src/MediaFinders/AbstractPodcastFinder.php | 7 ++++++- .../src/MediaFinders/AbstractSoundcloudEmbedFinder.php | 5 +++++ .../src/MediaFinders/AbstractSpotifyEmbedFinder.php | 5 +++++ 5 files changed, 26 insertions(+), 1 deletion(-) diff --git a/lib/Documents/src/MediaFinders/AbstractDeezerEmbedFinder.php b/lib/Documents/src/MediaFinders/AbstractDeezerEmbedFinder.php index bb2175c3..27f23bf3 100644 --- a/lib/Documents/src/MediaFinders/AbstractDeezerEmbedFinder.php +++ b/lib/Documents/src/MediaFinders/AbstractDeezerEmbedFinder.php @@ -165,4 +165,9 @@ public function getSource(array &$options = []): string // https://widget.deezer.com/widget/dark/playlist/9313425622 return $baseUri . '?' . http_build_query($queryString); } + + protected function areDuplicatesAllowed(): bool + { + return true; + } } diff --git a/lib/Documents/src/MediaFinders/AbstractMixcloudEmbedFinder.php b/lib/Documents/src/MediaFinders/AbstractMixcloudEmbedFinder.php index e110c32e..3d3f1cab 100644 --- a/lib/Documents/src/MediaFinders/AbstractMixcloudEmbedFinder.php +++ b/lib/Documents/src/MediaFinders/AbstractMixcloudEmbedFinder.php @@ -145,4 +145,9 @@ public function getSource(array &$options = []): string return 'https://www.mixcloud.com/widget/iframe/?' . http_build_query($queryString); } + + protected function areDuplicatesAllowed(): bool + { + return true; + } } diff --git a/lib/Documents/src/MediaFinders/AbstractPodcastFinder.php b/lib/Documents/src/MediaFinders/AbstractPodcastFinder.php index 0dfb41a1..fa238d0b 100644 --- a/lib/Documents/src/MediaFinders/AbstractPodcastFinder.php +++ b/lib/Documents/src/MediaFinders/AbstractPodcastFinder.php @@ -107,7 +107,7 @@ public function createDocumentFromFeed( if (null !== $file) { $documentFactory->setFile($file); - $document = $documentFactory->getDocument(); + $document = $documentFactory->getDocument(false, $this->areDuplicatesAllowed()); if (null !== $document) { /* * Create document metas @@ -239,4 +239,9 @@ public function getThumbnailURL(): ?string } return null; } + + protected function areDuplicatesAllowed(): bool + { + return true; + } } diff --git a/lib/Documents/src/MediaFinders/AbstractSoundcloudEmbedFinder.php b/lib/Documents/src/MediaFinders/AbstractSoundcloudEmbedFinder.php index 49e04545..3d15b3dd 100644 --- a/lib/Documents/src/MediaFinders/AbstractSoundcloudEmbedFinder.php +++ b/lib/Documents/src/MediaFinders/AbstractSoundcloudEmbedFinder.php @@ -154,4 +154,9 @@ public function getSource(array &$options = []): string return 'https://w.soundcloud.com/player/?' . http_build_query($queryString); } + + protected function areDuplicatesAllowed(): bool + { + return true; + } } diff --git a/lib/Documents/src/MediaFinders/AbstractSpotifyEmbedFinder.php b/lib/Documents/src/MediaFinders/AbstractSpotifyEmbedFinder.php index f9d13370..1fed0b8d 100644 --- a/lib/Documents/src/MediaFinders/AbstractSpotifyEmbedFinder.php +++ b/lib/Documents/src/MediaFinders/AbstractSpotifyEmbedFinder.php @@ -153,4 +153,9 @@ public function getSource(array &$options = []): string return $this->embedId; } + + protected function areDuplicatesAllowed(): bool + { + return true; + } } From b6f1af4c089e297c88dda7081c27ee3ea42570a5 Mon Sep 17 00:00:00 2001 From: Ambroise Maupate Date: Thu, 10 Oct 2024 18:58:48 +0200 Subject: [PATCH 3/3] chore: Bumped --- CHANGELOG.md | 7 +++++++ lib/RoadizCoreBundle/config/services.yaml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f6bba53..9672fbde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to Roadiz will be documented in this file. +## [2.3.29](https://github.com/roadiz/core-bundle-dev-app/compare/v2.3.28...v2.3.29) - 2024-10-10 + +### Bug Fixes + +- Allow duplicated documents when embedding audio embed covers, fix #19 - ([e61e2ee](https://github.com/roadiz/core-bundle-dev-app/commit/e61e2ee7f6caf12275a86519085e50d41917003b)) +- Do not throw exception on bad page and itemPerPage argument, just use defaults fix #20 - ([e051822](https://github.com/roadiz/core-bundle-dev-app/commit/e05182222564e2a4dd59048cbac5d7771fc99d82)) + ## [2.3.28](https://github.com/roadiz/core-bundle-dev-app/compare/v2.3.27...v2.3.28) - 2024-09-24 ### Bug Fixes diff --git a/lib/RoadizCoreBundle/config/services.yaml b/lib/RoadizCoreBundle/config/services.yaml index ba81df37..ee7c4147 100644 --- a/lib/RoadizCoreBundle/config/services.yaml +++ b/lib/RoadizCoreBundle/config/services.yaml @@ -1,6 +1,6 @@ --- parameters: - roadiz_core.cms_version: '2.3.28' + roadiz_core.cms_version: '2.3.29' roadiz_core.cms_version_prefix: 'main' env(APP_NAMESPACE): "roadiz" env(APP_VERSION): "0.1.0"