mirror of
https://github.com/ad-aures/castopod.git
synced 2026-04-13 11:37:46 +02:00
feat(episode-unpublish): remove episode comments upon unpublish
This commit is contained in:
parent
8acdafd260
commit
78acd7f5c0
17 changed files with 124 additions and 40 deletions
|
|
@ -722,6 +722,16 @@ class EpisodeController extends BaseController
|
|||
(new PostModel())->removePost($post);
|
||||
}
|
||||
|
||||
$allCommentsLinkedToEpisode = (new EpisodeCommentModel())
|
||||
->where([
|
||||
'episode_id' => $this->episode->id,
|
||||
'in_reply_to_id' => null,
|
||||
])
|
||||
->findAll();
|
||||
foreach ($allCommentsLinkedToEpisode as $comment) {
|
||||
(new EpisodeCommentModel())->removeComment($comment);
|
||||
}
|
||||
|
||||
// set episode published_at to null to unpublish
|
||||
$this->episode->published_at = null;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue