feat(episode-unpublish): remove episode comments upon unpublish

This commit is contained in:
Yassine Doghri 2022-07-21 16:21:26 +00:00
commit 78acd7f5c0
17 changed files with 124 additions and 40 deletions

View file

@ -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;