From 242352c4d9cd936de14e8e8a5d78ebf1287b1f95 Mon Sep 17 00:00:00 2001
From: Yassine Doghri <yassine@doghri.fr>
Date: Thu, 29 Sep 2022 11:10:11 +0000
Subject: [PATCH] fix(premium-podcasts): remove cache in unlock form + redirect
 to podcast if podcast is not premium

---
 modules/PremiumPodcasts/Controllers/LockController.php | 8 +++++---
 themes/cp_app/podcast/unlock.php                       | 6 ++----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/modules/PremiumPodcasts/Controllers/LockController.php b/modules/PremiumPodcasts/Controllers/LockController.php
index 2a50727344..6889903987 100644
--- a/modules/PremiumPodcasts/Controllers/LockController.php
+++ b/modules/PremiumPodcasts/Controllers/LockController.php
@@ -43,11 +43,13 @@ class LockController extends BaseController
         return $this->{$method}();
     }
 
-    public function index(): string
+    public function index(): RedirectResponse|string
     {
+        if (! $this->podcast->is_premium) {
+            return redirect()->route('podcast-activity', [$this->podcast->handle]);
+        }
+
         $data = [
-            // TODO: metatags for locked premium podcasts
-            'metatags' => '',
             'podcast' => $this->podcast,
         ];
 
diff --git a/themes/cp_app/podcast/unlock.php b/themes/cp_app/podcast/unlock.php
index 78ec988cbc..aaa3d0ec61 100644
--- a/themes/cp_app/podcast/unlock.php
+++ b/themes/cp_app/podcast/unlock.php
@@ -22,8 +22,6 @@
     }
     </script>
 
-    <?= $metatags ?>
-
     <link rel='stylesheet' type='text/css' href='<?= route_to('themes-colors-css') ?>' />
     <?= service('vite')
         ->asset('styles/index.css', 'css') ?>
@@ -77,8 +75,8 @@
         <div class="flex items-center pl-4 -mb-6 md:pl-8 md:-mb-8 gap-x-4">
             <img src="<?= $podcast->cover->thumbnail_url ?>" alt="<?= esc($podcast->title) ?>" class="z-[45] h-24 rounded-full sm:h-28 md:h-36 ring-3 ring-background-elevated aspect-square" loading="lazy" />
             <div class="relative flex flex-col text-white -top-3 sm:top-0 md:top-2">
-                <h1 class="text-lg font-bold leading-none line-clamp-2 md:leading-none md:text-2xl font-display"><?= esc($podcast->title) ?><span class="ml-1 font-sans text-base font-normal">@<?= esc($podcast->handle) ?></span></h1>
-                <div class="">
+                <div class="text-lg font-bold leading-none line-clamp-2 md:leading-none md:text-2xl font-display"><?= esc($podcast->title) ?><span class="ml-1 font-sans text-base font-normal">@<?= esc($podcast->handle) ?></span></div>
+                <div>
                     <?= explicit_badge($podcast->parental_advisory === 'explicit', 'mr-1') ?>
                     <span class="text-xs"><?= lang('Podcast.followers', [
                         'numberOfFollowers' => $podcast->actor->followers_count,
-- 
GitLab