mirror of
https://github.com/ad-aures/castopod.git
synced 2026-04-11 02:36:42 +02:00
feat: add publish feature for podcasts and set draft by default
closes #128, #220
This commit is contained in:
parent
9843ce3882
commit
3d363f2efe
25 changed files with 909 additions and 109 deletions
|
|
@ -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]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue