Loading app/Views/Components/Forms/Checkbox.php +1 −1 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ class Checkbox extends FormComponent $hint = $this->hint === null ? '' : hint_tooltip($this->hint, 'ml-1'); return <<<HTML <label class="leading-8"> <label class="leading-8 {$this->class}"> {$checkboxInput} <span class="ml-2">{$this->slot}{$hint}</label> </label> Loading modules/Admin/Config/Routes.php +8 −0 Original line number Diff line number Diff line Loading @@ -272,6 +272,14 @@ $routes->group( 'permission:podcast_episodes-delete', ], ); $routes->post( 'delete', 'EpisodeController::attemptDelete/$1/$2', [ 'filter' => 'permission:podcast_episodes-delete', ], ); $routes->get( 'transcript-delete', 'EpisodeController::transcriptDelete/$1/$2', Loading modules/Admin/Controllers/EpisodeController.php +56 −2 Original line number Diff line number Diff line Loading @@ -684,9 +684,63 @@ class EpisodeController extends BaseController return redirect()->route('episode-view', [$this->podcast->id, $this->episode->id]); } public function delete(): RedirectResponse public function delete(): string { (new EpisodeModel())->delete($this->episode->id); helper(['form']); $data = [ 'podcast' => $this->podcast, 'episode' => $this->episode, ]; replace_breadcrumb_params([ 0 => $this->podcast->title, 1 => $this->episode->title, ]); return view('episode/delete', $data); } public function attemptDelete(): RedirectResponse { $rules = [ 'understand' => 'required', ]; if (! $this->validate($rules)) { return redirect() ->back() ->withInput() ->with('errors', $this->validator->getErrors()); } $db = db_connect(); $db->transStart(); $allPostsLinkedToEpisode = (new PostModel()) ->where([ 'episode_id' => $this->episode->id, ]) ->findAll(); foreach ($allPostsLinkedToEpisode as $post) { (new PostModel())->removePost($post); } // set episode published_at to null to unpublish before deletion $this->episode->published_at = null; $episodeModel = new EpisodeModel(); if (! $episodeModel->update($this->episode->id, $this->episode)) { $db->transRollback(); return redirect() ->back() ->withInput() ->with('errors', $episodeModel->errors()); } $episodeModel->delete($this->episode->id); $db->transComplete(); return redirect()->route('episode-list', [$this->podcast->id]); } Loading modules/Admin/Language/en/Breadcrumb.php +1 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ return [ 'publish' => 'publish', 'publish-edit' => 'edit publication', 'unpublish' => 'unpublish', 'delete' => 'delete', 'fediverse' => 'fediverse', 'block-lists' => 'block lists', 'users' => 'users', Loading modules/Admin/Language/en/Episode.php +7 −1 Original line number Diff line number Diff line Loading @@ -137,10 +137,16 @@ return [ ], 'unpublish_form' => [ 'disclaimer' => "Unpublishing the episode will delete all the notes associated with the episode and remove it from the podcast's RSS feed.", "Unpublishing the episode will delete all the posts associated with it and remove it from the podcast's RSS feed.", 'understand' => 'I understand, I want to unpublish the episode', 'submit' => 'Unpublish', ], 'delete_form' => [ 'disclaimer' => "Deleting the episode will delete all the posts associated with it and remove it from the podcast's RSS feed.", 'understand' => 'I understand, I want to delete the episode', 'submit' => 'Delete', ], 'soundbites' => 'Soundbites', 'soundbites_form' => [ 'title' => 'Edit soundbites', Loading Loading
app/Views/Components/Forms/Checkbox.php +1 −1 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ class Checkbox extends FormComponent $hint = $this->hint === null ? '' : hint_tooltip($this->hint, 'ml-1'); return <<<HTML <label class="leading-8"> <label class="leading-8 {$this->class}"> {$checkboxInput} <span class="ml-2">{$this->slot}{$hint}</label> </label> Loading
modules/Admin/Config/Routes.php +8 −0 Original line number Diff line number Diff line Loading @@ -272,6 +272,14 @@ $routes->group( 'permission:podcast_episodes-delete', ], ); $routes->post( 'delete', 'EpisodeController::attemptDelete/$1/$2', [ 'filter' => 'permission:podcast_episodes-delete', ], ); $routes->get( 'transcript-delete', 'EpisodeController::transcriptDelete/$1/$2', Loading
modules/Admin/Controllers/EpisodeController.php +56 −2 Original line number Diff line number Diff line Loading @@ -684,9 +684,63 @@ class EpisodeController extends BaseController return redirect()->route('episode-view', [$this->podcast->id, $this->episode->id]); } public function delete(): RedirectResponse public function delete(): string { (new EpisodeModel())->delete($this->episode->id); helper(['form']); $data = [ 'podcast' => $this->podcast, 'episode' => $this->episode, ]; replace_breadcrumb_params([ 0 => $this->podcast->title, 1 => $this->episode->title, ]); return view('episode/delete', $data); } public function attemptDelete(): RedirectResponse { $rules = [ 'understand' => 'required', ]; if (! $this->validate($rules)) { return redirect() ->back() ->withInput() ->with('errors', $this->validator->getErrors()); } $db = db_connect(); $db->transStart(); $allPostsLinkedToEpisode = (new PostModel()) ->where([ 'episode_id' => $this->episode->id, ]) ->findAll(); foreach ($allPostsLinkedToEpisode as $post) { (new PostModel())->removePost($post); } // set episode published_at to null to unpublish before deletion $this->episode->published_at = null; $episodeModel = new EpisodeModel(); if (! $episodeModel->update($this->episode->id, $this->episode)) { $db->transRollback(); return redirect() ->back() ->withInput() ->with('errors', $episodeModel->errors()); } $episodeModel->delete($this->episode->id); $db->transComplete(); return redirect()->route('episode-list', [$this->podcast->id]); } Loading
modules/Admin/Language/en/Breadcrumb.php +1 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ return [ 'publish' => 'publish', 'publish-edit' => 'edit publication', 'unpublish' => 'unpublish', 'delete' => 'delete', 'fediverse' => 'fediverse', 'block-lists' => 'block lists', 'users' => 'users', Loading
modules/Admin/Language/en/Episode.php +7 −1 Original line number Diff line number Diff line Loading @@ -137,10 +137,16 @@ return [ ], 'unpublish_form' => [ 'disclaimer' => "Unpublishing the episode will delete all the notes associated with the episode and remove it from the podcast's RSS feed.", "Unpublishing the episode will delete all the posts associated with it and remove it from the podcast's RSS feed.", 'understand' => 'I understand, I want to unpublish the episode', 'submit' => 'Unpublish', ], 'delete_form' => [ 'disclaimer' => "Deleting the episode will delete all the posts associated with it and remove it from the podcast's RSS feed.", 'understand' => 'I understand, I want to delete the episode', 'submit' => 'Delete', ], 'soundbites' => 'Soundbites', 'soundbites_form' => [ 'title' => 'Edit soundbites', Loading