From 995ca5b197f8f917102a108dd07d1f81e99cc8e6 Mon Sep 17 00:00:00 2001
From: Yassine Doghri <yassine@doghri.fr>
Date: Fri, 16 Aug 2024 12:54:12 +0000
Subject: [PATCH] fix(podcast-model): always query podcast from database when
 clearing cache

this prevents from having any unexpected caching side effects
---
 app/Models/PodcastModel.php | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/app/Models/PodcastModel.php b/app/Models/PodcastModel.php
index 79f24e02d0..2385b3919e 100644
--- a/app/Models/PodcastModel.php
+++ b/app/Models/PodcastModel.php
@@ -335,7 +335,7 @@ class PodcastModel extends Model
      */
     public function clearCache(array $data): array
     {
-        $podcast = (new self())->getPodcastById((int) (is_array($data['id']) ? $data['id'][0] : $data['id']));
+        $podcast = (new self())->find((int) (is_array($data['id']) ? $data['id'][0] : $data['id']));
 
         // delete cache for users' podcasts
         cache()
@@ -427,7 +427,7 @@ class PodcastModel extends Model
      */
     protected function setActorAvatar(array $data): array
     {
-        $podcast = (new self())->getPodcastById((int) (is_array($data['id']) ? $data['id'][0] : $data['id']));
+        $podcast = (new self())->find((int) (is_array($data['id']) ? $data['id'][0] : $data['id']));
 
         if ($podcast instanceof Podcast) {
             $podcastActor = (new ActorModel())->find($podcast->actor_id);
@@ -452,7 +452,7 @@ class PodcastModel extends Model
      */
     protected function updatePodcastActor(array $data): array
     {
-        $podcast = (new self())->getPodcastById((int) (is_array($data['id']) ? $data['id'][0] : $data['id']));
+        $podcast = (new self())->find((int) (is_array($data['id']) ? $data['id'][0] : $data['id']));
 
         if ($podcast instanceof Podcast) {
             $actorModel = new ActorModel();
-- 
GitLab