feat: add publish feature for podcasts and set draft by default

closes #128, #220
This commit is contained in:
Ola Hneini 2022-07-05 16:39:20 +00:00 committed by Yassine Doghri
commit 3d363f2efe
25 changed files with 909 additions and 109 deletions

View file

@ -450,12 +450,27 @@ class PodcastImportController extends BaseController
->with('errors', $episodePersonModel->errors());
}
}
if ($itemNumber === 1) {
$firstEpisodePublicationDate = strtotime((string) $item->pubDate);
}
}
// set interact as the newly imported podcast actor
$importedPodcast = (new PodcastModel())->getPodcastById($newPodcastId);
set_interact_as_actor($importedPodcast->actor_id);
// set podcast publication date
$importedPodcast->published_at = $firstEpisodePublicationDate ?? $importedPodcast->created_at;
$podcastModel = new PodcastModel();
if (! $podcastModel->update($importedPodcast->id, $importedPodcast)) {
$db->transRollback();
return redirect()
->back()
->withInput()
->with('errors', $podcastModel->errors());
}
$db->transComplete();
return redirect()->route('podcast-view', [$newPodcastId]);