From 5855a250936f91641efef77650890a18d8e9917f Mon Sep 17 00:00:00 2001 From: Yassine Doghri <yassine@doghri.fr> Date: Thu, 3 Feb 2022 14:00:01 +0000 Subject: [PATCH] fix(podcast-activity): check if transcript and chapters are set before including them in audio --- app/Libraries/PodcastEpisode.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/Libraries/PodcastEpisode.php b/app/Libraries/PodcastEpisode.php index a118315d0a..71e3dd36de 100644 --- a/app/Libraries/PodcastEpisode.php +++ b/app/Libraries/PodcastEpisode.php @@ -68,10 +68,16 @@ class PodcastEpisode extends ObjectType 'type' => 'Link', 'mediaType' => $episode->audio->file_mimetype, ], - 'transcript' => $episode->transcript->file_url, - 'chapters' => $episode->chapters->file_url, ]; + if ($episode->transcript !== null) { + $this->audio['transcript'] = $episode->transcript->file_url; + } + + if ($episode->chapters !== null) { + $this->audio['chapters'] = $episode->chapters->file_url; + } + $this->comments = url_to('episode-comments', $episode->podcast->handle, $episode->slug); if ($episode->published_at !== null) { -- GitLab