Wire up `is_enabled` functionality for public podcast pages.
This commit is contained in:
parent
da51ec823c
commit
b1662a4757
|
@ -36,7 +36,7 @@
|
|||
<h5 class="m-0">
|
||||
{{ item.title }}
|
||||
</h5>
|
||||
<div v-if="item.is_published">
|
||||
<div v-if="item.is_published && item.is_enabled">
|
||||
<a
|
||||
:href="item.links.public_episodes"
|
||||
target="_blank"
|
||||
|
@ -59,6 +59,12 @@
|
|||
>
|
||||
{{ $gettext('Unpublished') }}
|
||||
</span>
|
||||
<span
|
||||
v-if="!item.is_enabled"
|
||||
class="badge text-bg-danger"
|
||||
>
|
||||
{{ $gettext('Disabled') }}
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #cell(actions)="{item}">
|
||||
|
|
|
@ -35,6 +35,7 @@ final class ListPodcastsAction implements SingleActionInterface
|
|||
->from(Podcast::class, 'p')
|
||||
->leftJoin('p.categories', 'pc')
|
||||
->where('p.storage_location = :storageLocation')
|
||||
->andWhere('p.is_enabled = 1')
|
||||
->setParameter('storageLocation', $station->getPodcastsStorageLocation())
|
||||
->andWhere('p.id IN (:podcastIds)')
|
||||
->setParameter('podcastIds', $this->podcastRepo->getPodcastIdsWithPublishedEpisodes($station))
|
||||
|
|
|
@ -27,7 +27,8 @@ final class RequirePublishedPodcastEpisodeMiddleware extends AbstractMiddleware
|
|||
$publishedPodcastIds = $this->podcastRepository->getPodcastIdsWithPublishedEpisodes($station);
|
||||
|
||||
$podcast = $request->getPodcast();
|
||||
if (!in_array($podcast->getIdRequired(), $publishedPodcastIds, true)) {
|
||||
|
||||
if (!$podcast->isEnabled() || !in_array($podcast->getIdRequired(), $publishedPodcastIds, true)) {
|
||||
throw NotFoundException::podcast();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue